Hi all,
I'm trying to format a cell to a specific time format. I have another workbook with the correct time format that I'm trying to replicate: The cell shows "16:00", and the formula bar shows "4:00:00 PM". When I go into that cell and look at the cell format being used, it shows "Custom" as the category and "h:mm" as the Type.
I have tried to replicate this in my code with:
or even:
I have not had any luck with either of these. It just ends up showing "16:00" in the formula bar, as opposed to the desired "4:00:00 PM"
Any other suggestions please?
Thanks.
I'm trying to format a cell to a specific time format. I have another workbook with the correct time format that I'm trying to replicate: The cell shows "16:00", and the formula bar shows "4:00:00 PM". When I go into that cell and look at the cell format being used, it shows "Custom" as the category and "h:mm" as the Type.
I have tried to replicate this in my code with:
VBA Code:
Range("S2").Select
Selection.NumberFormat = "h:mm:"
or even:
VBA Code:
Range("S2").Select
Selection.NumberFormat = "h:mm:ss: AM/PM"
I have not had any luck with either of these. It just ends up showing "16:00" in the formula bar, as opposed to the desired "4:00:00 PM"
Any other suggestions please?
Thanks.