VBA Refrence from a text box?

Cease

Board Regular
Joined
Dec 28, 2010
Messages
112
Hi,
Is it possible to use a text box or other object as a reference point in VBA?

I'm trying to use a simple code:
Code:
Sub Show1()
    Range("A17").Select
    ActiveCell.Rows("1:37").EntireRow.Select
    Selection.EntireRow.Hidden = False
 
    Range("b18").Select
End Sub

But I want to apply this to about 100 different ranges. I was trying to set this up as a module, my only problem is I won't know what cell the user will select beforehand to use as a reference.

For instance, I have text box 1, located in a:17 assigned to this module to unhide rows 18 to 53.
Ideally I want to use the same module for text box 2, located in a:54 to unhide rows 55 to 92.

I'm sure there's a way, but I'm having trouble finding it.
Thank you for your time in advance!
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,214,827
Messages
6,121,818
Members
449,049
Latest member
cybersurfer5000

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