0

I have a report and in columns L to Y I have the time of hh:mm:ss written as text and as a result I'm unable to do pivot calculations.

Is there an excel vba script that I can use to convert columns L:Y to the time value of hh:mm:ss?

any help would be appreciated.

Thanks

Community
  • 1
  • 1
spittingfire
  • 101
  • 2
  • 3
  • 12

2 Answers2

1

A bit late, but another similar solution is to copy a blank cell and add it to the range with Paste Special

or better, change the format and copy the values like this:

Set r = Intersect(UsedRange, Range("L:Y"))  ' only the used range in columns L to Y
r.NumberFormat = "HH:mm:ss"    ' military time format 24:59:59 ?
r.Value2 = r.Value2
Slai
  • 22,144
  • 5
  • 45
  • 53
0

Without using VBA, you could perhaps put a formula in columns Z onwards, e.g. Z2's formula could say =TIMEVALUE(L2) etc.

Using VBA, you could use either the CDate or TimeValue functions to convert the string to a date/time.

YowE3K
  • 23,852
  • 7
  • 26
  • 40