Replace any value in cell with another using VBA

K1600

Board Regular
Joined
Oct 20, 2017
Messages
181
I am trying to replace all values in column K in my spreadsheet using VBA with a date 14 days from today. I've tried using find and replace but the value to be replaced could be anything.

I was trying the below code but not sure what to put in the Find:= bit......

VBA Code:
        sh2.Columns("K").Replace _
            what:="***Not sure what to put here***", replacement:=Format(Date + 14, "dd/mm/yyyy"), _
                searchorder:=xlByColumns, MatchCase:=True

Any help would be appreciated.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Use a wildcard "*". Be careful to save workbook before you run it in case it doesnt do what you want.
 
Upvote 0
Use a wildcard "*". Be careful to save workbook before you run it in case it doesnt do what you want.
I hate technology sometimes. I had tried that already and it didn't work but I've just tried it again and it has.... ?‍♂️

Thanks for the help.
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,853
Members
449,194
Latest member
HellScout

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