英文:
How do you remove the colon from a time in the "HH:MM" format when the time is placed in the range from an array?
问题
Sheet 1:
8:00 AM
9:00 AM
12:00 AM
2:00 PM
2:43 PM
Sheet 2:
800
900
1200
200
243
英文:
I have a database of times formatted as "8:00 AM", "12:00 PM", etc. I need to transfer those times to a different sheet in a different format.
Ex:
Sheet 1:
8:00 AM
9:00 AM
12:00 AM
2:00 Pm
2:43 PM
Sheet 2:
800
900
1200
200
243
I tried to just use the left and right functions, but it would read it as a decimal.
'For single digit hours
NewTime(i) = Left(NewTime(i),1) & Right(NewTime(i),2)
答案1
得分: 2
你将一个新的.NumberFormat
应用于该范围,例如:
Sheet2.Range("A1:A5").NumberFormat = "hmm"
英文:
You apply a new .NumberFormat
to the range, e.g.
Sheet2.Range("A1:A5").NumberFormat = "hmm"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论