View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Variable equal to values in a list

Say we only want to run a macro on Named Ranges on Sheet1:

Sub servient()
For Each n In ActiveWorkbook.Names
v = n.RefersTo
If InStr(v, "Sheet1") < 0 Then
'call your macro
End If
Next
End Sub


So we look at all the Named Ranges, but only call the macro when the range
is on Sheet1.
--
Gary''s Student - gsnu200805


"nolegrad93" wrote:

I'm trying to write a macro that will perfom the same subroutine on multiple
ranges. All ranges are on a single worksheet. Each range is named. Each
name appears in a list on a separate worksheet.

I think I need to declare a variable and somehow use the list of range names
as values for the variable.