OilEconomist
Active Member
- Joined
- Dec 26, 2016
- Messages
- 421
- Office Version
- 2019
- Platform
- Windows
Thanks in advance for any assistance. Is there a way to reduce the number of lines in the following code. Please note what the code does it allows me to enter a value like 4 and then converts it to 04:00 AM EST. I want to make sure it keeps the leading 0 before the 4.
VBA Code:
Sub RdcCode()
For i = 6 To 11
Range("D" & i) = "=TIME(B" & i & ", 0, 0)"
Range("D" & i).NumberFormat = "hh:mm AM/PM ""EST"""
Range("D" & i).Formula = Range("D" & i).Value
Next i
End Sub