issue displaying date with applied format

Bill_Davenport

New Member
Joined
Jul 25, 2017
Messages
13
Hello,

I currently have a script dumping information into an email however the date format in my spreadsheet is too long and i'd like to cut it down to just display the Hour currently the date is formatted like this:

01/08/2017 8:00:00 AM

and I would prefer to just show 8 (8am basically) and dump it into an email however when i do this the date format is getting messed up and it shows up weird.

this is the code i'm using to format the date to only show the hour, which works in excel.
Code:
Selection.NumberFormat = "h"

this is the code i'm using to dump it into an email
Code:
With OutMail
        .To = distgrp
        .CC = cclist
        .BCC = ""
        .Subject = "*URGENT* " & Range("H" & i).Value & " - Not ready " & Range("F" & i).Value & " to " & Range("G" & i).Value & ". Order# " & Range("B" & i).Value
        .HTMLBody = strbody
        .Display
    End With

when i run this code the subject line is showing up *URGENT* North - Not ready 42948.3333333333

any suggestions on how i can have this display just the hour instead of 42948.3333?

thanks!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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