Excel Excel Macro - Set Range to Text in Cell

Joined
Apr 19, 2011
Messages
1
Reaction score
0
Hi,
I'm relatively new to VBA, so excuse me if this is a dumb question. I have a workbook with a tab that users enter different variables into. One cell is meant to input a range that later on will be used to perform selections on other tabs. I can't seem to set my range to the text in the input cell. An abbreviated form of the macro I'm trying to use is this:

Sub Macro1()
Dim RetrieveRange As range

Set RetrieveRange = range(Worksheets("Admin").range("B1").Text)

MsgBox RetrieveRange.Address

End Sub

I keep getting this error: "Run-time error '1004': Method 'Range' of object '_Global' failed"

Can anyone help?

Thanks!
 
Joined
Sep 3, 2008
Messages
164
Reaction score
5
I pasted your code as a macro, created an Admin tab, and entered a valid range (A1:A2) and it worked for me. I entered an invalid range ('before') and got the error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top