VBA - Refrence cells and keep format

30136353

Board Regular
Joined
Aug 14, 2019
Messages
105
HI Guys,

I have the below piece of code that references 2 cells, which contains dates but formatted as address numbers. I.E Shows within the cell as "7/1", but actual value is 07/01/2020 or 43837. I need the code to reference the "7/1" format as I then later in the code use this reference to search for the address online... Can anyone assist?

VBA Code:
    Range("O2:O" & Range("A" & Rows.count).End(xlUp).Row).Formula = "=B2&c2"
 

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.
How about
VBA Code:
Range("O2:O" & Range("A" & Rows.count).End(xlUp).Row).Formula = "=text(B2,"d/m")&text(c2,"d/m")"
 
Upvote 0
Oops, it should be
VBA Code:
Range("O2:O" & Range("A" & Rows.count).End(xlUp).Row).Formula = "=text(B2,""d/m"")&text(c2,""d/m"")"
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,409
Members
448,959
Latest member
camelliaCase

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