Cell contents appearing as a decimal not time

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello all,

I am trying to send cell contents to an email, but time values in my cells are converting to decimals. Is there a simple way to make it show the time properly? I thought .value would do it, but it didn't make a difference.

Code:
Else  Gmail "z@gmail.com", "zzz", "", _
    "o> " & vbNewLine & Sheets("Print").Range("AH4") & vbNewLine & Sheets("Print").Range("AH5") & vbNewLine & Sheets("Print").Range("AH6") & "  " & Sheets("Print").Range("AI6") & "  " & Sheets("Print").Range("AJ6").Value & "  " & Sheets("Print").Range("AK6") & "  " & Sheets("Print").Range("AL6").Value & "", _
    sTo, _
    "1@2.3", _
    pdf
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
So that works, but it isn't showing AM/PM. How would I do that?

You use as na example 13:48, so I assumed you used 24-hour format, which doesn't need AM/PM, but if you want the am/pm to be displayed you can just add am/pm in the format function, like

Code:
Format(Sheets("Print").Range("AL6").Value, "HH:nn AM/PM")

Plus, you can format the am/pm in the following 5 diferente ways, just use the upper or lower case options below:


AM/PM

Use the 12-hour clock and display an uppercase AM with any hour before noon; display an uppercase PM with any hour between noon and 11:59 P.M.

am/pm

Use the 12-hour clock and display a lowercase AM with any hour before noon; display a lowercase PM with any hour between noon and 11:59 P.M.

A/P

Use the 12-hour clock and display an uppercase A with any hour before noon; display an uppercase P with any hour between noon and 11:59 P.M.

a/p

Use the 12-hour clock and display a lowercase A with any hour before noon; display a lowercase P with any hour between noon and 11:59 P.M.

AMPM
Use the 12-hour clock and display the AM string literal as defined by your system with any hour before noon; display the PM string literal as defined by your system with any hour between noon and 11:59 P.M. AMPM can be either uppercase or lowercase, but the case of the string displayed matches the string as defined by your system settings. The default format is AM/PM.
 
Upvote 0

Forum statistics

Threads
1,215,493
Messages
6,125,128
Members
449,206
Latest member
burgsrus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top