Passing Names to Macro's

  • Thread starter Thread starter Randy Numbers
  • Start date Start date
R

Randy Numbers

How can I have a macro recognize a named range? E.g. ADDON=5 is defined
and named in a cell, and I want to reference it in the macro.

Thanks.../RN
 
RN

Like this

Sub referToRange()
Dim sRangeName As String
sRangeName = ThisWorkbook.Names("ADDON").Value
MsgBox "ADDON Value" & sRangeName
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Frank,

Thanks again for all your help. Here is what I'm trying to do:

If MsgBox Range("addon_flag").Value _
Then
DIV = 100
resid = 10
End If

In other words, addon_flag is either 1 or 0; if 1 I want to do some stuff,
otherwise not... thanks../RN
 
Hi
make this
If Range("addon_flag").Value Then
DIV = 100
resid = 10
End If
 
Nick,

Thanks for your help -- between you and Frank I got what I needed! ../RN
 

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