Inserting worksheet calculations into macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to automate a macro to use calculated cell addresses in the macro (see
present macro)

Sub Macro4()
CELL = "AZ54"
RANGE (CELL).select
End Sub

How can I insert a calculated Cell Address for the AZ54 in the above macro?
 
Depends how you are calculating the address.

DIM strAddress as string
strAddress = "AZ"&54

if cell A1 on the active sheet contained an address like AZ54, you can do:

Range(range("A1").value).Select


BTW, you rarely need to SELECT a range. Most things can be done simply by
referencing the range. For example:

range("AZ54").formula = "=A1+c1"
 
Thanks, I will try one or both of your comments. I am using the Range
selection because that is what the macro generator spit out when I recorded
the macro, (I am still learning how to work with VBA and macros).
 
The macro recorder doesn't give the most efficient macros. I generally clean
up the worksheet and/or range selection after I record a macro.

HTH,
Barb Reinhardt
 

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

Back
Top