I have several named ranges I would like to run a process on, how to iterate/loop across a number of named ranges

Biff Malibu 636

New Member
Joined
Mar 15, 2017
Messages
8
Hello, and thank you for taking the time to read and help me with what is probably a simple issue, but I can't seem to figure it out. I have a script of code I'd like to run on several named ranges (a ranking feature). My question is how do I take a list of named ranges and loop through them. My sheet looks like this:
1600811826540.png

I would like to run the following script of code on "US Sectors Continued"
VBA Code:
Sub ADD_RANKS()
'need to learn how to loop through named ranges
Dim cell As Range
Dim i As Integer
i = 1
For Each cell In Range("EUROPEAFRICA")
    If cell.Column = 1 Then
    
    cell.Offset(0, 2).Value = i
    i = i + 1
    End If
Next

End Sub
thank you for any help!
regards,
Tony
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Put your list of Names in column E starting in E4, and use this code to cycle through the list:

VBA Code:
Sub CycleThroughNames()
  Dim c As Range
  For Each c In ActiveSheet.Range("E4:E25").Cells
    If Len(c.Value) > 0 Then
      Dim cel As Range
      For Each cel In ActiveSheet.Range(c.Value).Cells
        '' do the thing
        ''
      Next
    End If
  Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,294
Members
449,149
Latest member
mwdbActuary

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