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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,215,333
Messages
6,124,317
Members
449,153
Latest member
JazzSingerNL

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