reference a column

Svgmassive

Board Regular
Joined
Nov 2, 2010
Messages
113
I want to create a name range WK_Col which would be column a to use in formula (vba) what's the best approach.Thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
That i understand. The problem is this.I have a name range call Wk_Col which references =Sheet1!$A:$A.the problem is this when i reference a range in vba
Range(Cells(5, [Wk_Col].column), Cells(8, [Wk_Col].Column)) i have to use the [Wk_Col].Column instead of just [Wk_Col].
thanks
 
Upvote 0
Maybe this

Code:
Dim rng As Range
   
Set rng = Range([Wk_Col].Cells(5), [Wk_Col].Cells(8))


HTH

M.
 
Upvote 0
That i understand. The problem is this.I have a name range call Wk_Col which references =Sheet1!$A:$A.the problem is this when i reference a range in vba
Range(Cells(5, [Wk_Col].column), Cells(8, [Wk_Col].Column)) i have to use the [Wk_Col].Column instead of just [Wk_Col].
thanks


You can try...

Set Wk_Col=Sheet1.Range("A:A") or
Set Wk_Col=Sheet1.Range("A")

then...

Range(cells(5,Wk_Col),cells(8,Wk_Col))
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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