Text Equivalent of A Formatted Date

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,

I have this piece of code ....
Code:
       If tcol = 8 Then
            .Cells(irw, tcol).Value = Format(bkg_date - 1, "dd-mmm")
            irw = irw + 1
        End If

That places a date value in the cell defined by .cells(irw,tcol).
This cell is normally, and must remain, as text. So, when the date value gets placed, it appears as that date's serial.
Since the date won't be used for any calculations, there is no reason why it can't be the text equivalent of "dd-mmm". What can I do to place that text equivalent of "dd-mmm" in that cell?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try
VBA Code:
.Cells(irw, tcol).NumberFormat = "@"
.Cells(irw, tcol).Value = Format(bkg_date - 1, "dd-mmm")
 
Upvote 0
Solution
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,693
Members
449,048
Latest member
81jamesacct

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