View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Why do I get an error in this code???

WB is an object, so use

Set WB = ThisWorkbook

HTH,
Bernie
MS Excel MVP


"Charlotte E." wrote in message ...
Why do I get an error in the third line of this little code:

Dim WS As Worksheet
Dim WB As Workbook

WB = ThisWorkbook
For Each WS In WB.Worksheets


????