linux date 2007-01-01,Excel日期格式问题(00/01/1990)(Excel date format issue (00/01/1990))

Excel日期格式问题(00/01/1990)(Excel date format issue (00/01/1990))

我只是试图将0(实际上是日期格式= 00/01/201)替换为NA

所以我录制了宏。 我在不同的文件中检查了该宏,但它无法正常工作。 如果我为每个单元格单击F2 ,那么我尝试重新运行宏,然后它正常工作。 任何其他跳过的方法按每个范围按F2 (有数千个范围)..例如,如果A1,B1,A2和B2有00/01/1900,当我运行下面的宏它不能正常工作..然后我试图再按F2为每个单元重新运行宏..然后它运行良好

代码:

Range("A1").Select

Range(Selection, Selection.End(xlDown)).Select

Range(Selection, Selection.End(xlToRight)).Select

Selection.Replace What:="00/01/1900", Replacement:="N/A", LookAt:=xlPart _

, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False

Range("AW1").Select

I just trying to replace the 0's(Actually it is in date format =00/01/1990) to N.A

So I have recorded the macro. I checked that macro in different file, but it is not working correctly. If I click F2 for each cell then I try to re run the macro then it is working fine. Any other ways to skip keep pressing F2 for each range (thousand of ranges are there) .. for ex if A1,B1,A2 and B2 have 00/01/1900 when I run the below macro its not working perfectly .. then I tried to press F2 for each cell again re run the macro ..then its working well

Code :

Range("A1").Select

Range(Selection, Selection.End(xlDown)).Select

Range(Selection, Selection.End(xlToRight)).Select

Selection.Replace What:="00/01/1900", Replacement:="N/A", LookAt:=xlPart _

, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False

Range("AW1").Select

原文:https://stackoverflow.com/questions/11304023

更新时间:2019-06-19 06:34

最满意答案

如果您尝试替换整个工作表,那么您可以使用它而不是每次都定义您的范围

Sub Sample()

With Sheets("Sheet1")

.Cells.Replace What:="00/01/1900", Replacement:="N/A", LookAt:=xlPart, _

SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False

End With

End Sub

If you are trying to replace in the entire worksheet then you can use this instead of defining your range everytime

Sub Sample()

With Sheets("Sheet1")

.Cells.Replace What:="00/01/1900", Replacement:="N/A", LookAt:=xlPart, _

SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False

End With

End Sub

2012-07-03

相关问答

如果您尝试替换整个工作表,那么您可以使用它而不是每次都定义您的范围 Sub Sample()

With Sheets("Sheet1")

.Cells.Replace What:="00/01/1900", Replacement:="N/A", LookAt:=xlPart, _

SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=Fa

...

这是一个有效的日期格式 - 2007-12-13 + 01:00? 是的,请参阅以下链接,了解格式的官方说明: http://www.w3.org/TR/xmlschema-2/#date-lexical-representation 你的错误 我们发现,我们以如下格式接收日期:2007-12-13 + 01:00并且它抛出一个异常:java.lang.NumberFormatException:无效的日期/时间 java.lang.NumberFormatException: Invalid d

...

您是否希望单元格包含日期/时间或显示日期/时间的文本? 如果是前者,请使用@ Peh的例子。 如果是后者,你可以使用旧的撇号技巧强制它: ...Offset(iCounter, 0).Value = "'" & Ucase(Format(tempString, "dd-mmm-yyyy hh:mm:ss"))

Did you want the cell to contain the date/time, or text that presents the date/time? If the fo

...

尝试这个: REPLACE(CONVERT(VARCHAR(15), pr.[Date], 106), ' ', '-')

这种方式将日期转换为VARCHAR并以所需格式显示。 有关CONVERT和支持格式的更多信息,请点击此处 Try this: REPLACE(CONVERT(VARCHAR(15), pr.[Date], 106), ' ', '-')

This way date is cast to VARCHAR and you get it displayed in the req

...

您可以通过文本字段的表达式设置时间格式。 单击文本框,然后按f4。 转到格式并单击下拉列表,然后单击表达式。 在表达式中你可以写这样的东西。 =switch("More than one hour","HH:mm:ss",

"less than one hour and more than a minute","MM:ss",

"Less than one minute","SS",) 你必须把我的条件放在我提到的时间('超过一年等')。 如果我还面临任何问题,请告诉我。 I coul

...

除非你的源数据总是有午夜的时间(我怀疑,否则时间不重要),增加12小时可能会导致错误的日期。 您可以通过从两种不同的格式代码中获取部分来实现: 120 - ODBC规范 - yyyy-mm-dd hh:mi:ss (24h) 109 - 默认+毫秒 - mon dd yyyy hh:mi:ss:mmmAM (或PM ) SELECT CONVERT(char(10),@date,120) + SUBSTRING(CONVERT(char(20),@date,109),12,9)

Unless y

...

尝试这个: SELECT FORMAT(CONVERT(DATETIME,STUFF(STUFF('01011900',5,0,'/'),3,0,'/')),'dd/MM/yyyy')

插入/使用STUFF ,然后转换它。 STUFF(STUFF('01011900',5,0,'/'),3,0,'/') -- 01/01/1900

更新 :我也试过以下, DECLARE @DateString varchar(10) = '12202012' --19991231 --25122000

D

...

NSDateFormatter将无法解析它,因为时区不符合RFC 822或GMT标准 。 问题出在最后一个“:”,你需要“GMT”。 您尊重RFC 3339的日期。 您将需要使用NSFormatter来解析它。 你应该使用getObjectValue:forString:errorDescription: 设置字符串@"yyyy-MM-dd'T'HH:mm:ss.SSSZ" 。 NSDateFormatter won't be able to parse it, because the timez

...

两者都使用setUTCHours(hours, minutes, seconds, ms)并单独调用每个函数。 尝试运行示例下方并与您的完整代码进行比较。 var date_from = new Date();

date_from.setDate(date_from.getDate() - 1);

date_from.setUTCHours(0,0,0,0);

console.log('example 1', date_from.toISOString());

da

...

没有任何意义,过去的任何日期都可以完成这项工作,有人选择了过去的任意日期。 这样你的浏览器就不会缓存页面:) 你的浏览器理解“这是好的,直到...”哦,我需要再次获取它,在这种情况下每次。 No significance, any date in the past will do the job, someone just picked an arbitrary past date. This is so your browser won't cache the page :) Your brow

...

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值