Changing Columns Reference Code??

stephen.smith

Board Regular
Joined
Jul 7, 2010
Messages
119
Hey guys
I am trying to change a cell reference using VBA. The reference has the column with $ before hand so, $B and I am trying to use code to change this to any other column example $K on many different cells at one time. I have tried a replace code but its not working because of the $ I think. I need to keep the $ in the reference, so is there a way to do this. Any help would be really appreciated. Below is an example of what i have tried.
Thanks
Stephen

Code:

Sub test()
On Error Resume Next
Dim c As String, d As String
c = InputBox("Enter Original Column Letter")
d = InputBox("Enter New Column Letter")
Range("A1:A100").Replace "$" & c, "$" & d
End Sub
 
That's great. Thanks so much, I'm new to all this so very sorry if this was a basic error. The help was greatly appreciated!
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi
I Have since tried changing the range to the cell path suggested, however this again does not work. The range I tried is pasted below. This is where the cell is referenced to find the values I am looking for. Can anyone please help.

='P:\IPS 201112\[Week By Week Risk Management Info.xlsx]Game Rate'!B100:J399
 
Upvote 0

Forum statistics

Threads
1,224,534
Messages
6,179,390
Members
452,909
Latest member
VickiS

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