View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default 'For Loop' For Selected Sheets/As Named In A Range


Hi,

Try these

Sub LoopSelected()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Windows(1).SelectedSheets
MsgBox sh.Name ' do your stuff here
Next sh
End Sub


Sub LoopSelected2()
For Each c In Range("A1:A3")
MsgBox Sheets(c.Value).Name ' do your stuff here
Next
End Sub

Mike

"Faraz A. Qureshi" wrote:

Could one of you experts kindly provide a sample code so as to determine how
to carry out an exercise of "For Loop" in the following cases?

For Each "sheet in the selected sheets"
...
...
Next

and

For Each "sheet with name listed in a range (e.g. Sheet1!A1:A10)"
...
...
Next

Thanx in advance

--
Best Regards,

Faraz