我的问题是你如何解析HH中给出的时间:MM:SS到HH和MM在VBA的不同列中?
答案 0 :(得分:1)
Minute()
和Hour()
来获得所需内容。答案 1 :(得分:1)
答案 2 :(得分:0)
对我有用的另一种方式如下:
Sub foo()
TextVar = Format(Sheet1.Cells(1, 1).Value, "hh:mm:ss") ' get the value from the cell and convert the value to the right format
varHours = Left(TextVar, 2) 'get the first two characters ie the Hours
varMinutes = Mid(TextVar, 4, 2) 'get the middle two characters ie the Minutes
varSeconds = Right(TextVar, 2) 'get the last two characters ie Seconds
MsgBox varHours & " " & varMinutes & " " & varSeconds
End Sub