View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default macro for multiple worksheets

ws.unprotect
ws. do something else

Depending on what you are doing, it probably is NOT necessary to select


--
Don Guillett
SalesAid Software

"Brian" wrote in message
...
Thanks, this looks like what I am looking for except these worksheets are
protected and must be unprotected to run the macro, then protected again
at
the conclusion of the macro.
ActiveSheet.Unprotect pops up an error as does SelectedSheets.Unprotect


"JE McGimpsey" wrote:

Number of worksheets selected (only one can be active at a time):


Dim nSelectedWS As Long
nSelectedWS = ActiveWindow.SelectedSheets.Count

for multiple worksheets:

Dim ws As Worksheet
For Each ws In Worksheets(Array("wks1", "wks3", "wks5"))
'do something with each ws
Next ws


In article ,
Brian wrote:

Is there a way to have a macro span multiple worksheets but not the
whole
workbook (i.e wks1,wks3,wks5 only)?

Also, is there a way to determine whether multiple worksheets have been
selected and activated?