vba - How to display hh:mm:ss in Excel? -
i'm new excel vba. want set loop display time each minute on minute in new cell.
is there way display time (hh:mm:ss) in cell without seeing date beside it? also, i'd time zone shown. (e.g. singapore time, "sgt").
here example of output i'd see:
23-oct-13 10:00:00 sgt 23-oct-13 10:01:00 sgt 23-oct-13 10:02:00 sgt 23-oct-13 10:03:00 sgt 23-oct-13 10:04:00 sgt 23-oct-13 10:05:00 sgt 23-oct-13 10:06:00 sgt 23-oct-13 10:07:00 sgt 23-oct-13 10:08:00 sgt 23-oct-13 10:09:00 sgt 23-oct-13 10:10:00 sgt 23-oct-13 10:11:00 sgt 23-oct-13 10:12:00 sgt 23-oct-13 10:13:00 sgt 23-oct-13 10:14:00 sgt 23-oct-13 10:15:00 sgt 23-oct-13 10:16:00 sgt 23-oct-13 10:17:00 sgt 23-oct-13 10:18:00 sgt 23-oct-13 10:19:00 sgt 23-oct-13 10:20:00 sgt ...
this should it, have fun. :-)
option explicit sub test() dim i&, stime date, timestep date, cell range '// format range cell 24hrs range("a1:a1440") '// 24h*60m .numberformat = "hh:mm:ss;@" end set cell = [a1] '// first cell write stime = "00:00:00" '// start time '// loop 24hrs timestep = "00:01:00" '// time increment = 0 1439 ' // 1439 means 1439 cells cell.offset(i, 0).value = stime stime = stime + timestep next end sub
start
end
Comments
Post a Comment