Select Table Range based on cell in another sheet

cizzett

Board Regular
Joined
Jan 10, 2019
Messages
121
Hey Guys, back again.
I have what I know is very simple but for some reason I am just drawing a blank today.

Basically I am tryiing to select a column range in a table based on the value of a cell in another sheet.

So I am trying to replace the value of "Replace-Me" in the code below to get the value of sheet OHR cell F2.

VBA Code:
Range("BaseTable[REPLACE-ME]").Select

in other words if sheet OHR cell F2 value is miscellaneaus1 then the code would get that value as the table column to select

Thanks in advance, this is my favorite message board and yall are always so awesome.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
How about
VBA Code:
Range("BaseTable[" & sheets("OHR").range("F2").value & "]").Select
 
Upvote 0
How about
VBA Code:
Range("BaseTable[" & sheets("OHR").range("F2").value & "]").Select
Still erroring out, I thought for sure that was it
 

Attachments

  • 2020-09-28_08h58_16.png
    2020-09-28_08h58_16.png
    17.1 KB · Views: 2
Upvote 0
What line gives the error?
 
Upvote 0
Is BaseTable a proper table, rather than a range?
If so, is it on the Remote Basses sheet?
 
Upvote 0
Yep, Proper Table and the sheet name it resides on is "Remote Bases" and the range that I am trying to reference for it is on the sheet "OHR"
 

Attachments

  • 2020-09-28_09h09_36.png
    2020-09-28_09h09_36.png
    5.3 KB · Views: 1
Upvote 0
In that case check for typos between F2 & the actual column headers, along with leading/trailing spaces.
 
Upvote 0
In that case check for typos between F2 & the actual column headers, along with leading/trailing spaces.
LOL, OMGosh I just made that so much harder than it needed to be............


F1 NOT F2

Now it works, thanks Fluff!!!!!!!!!!
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,253
Members
448,556
Latest member
peterhess2002

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