View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default assigning worksheet variable

Simon,

There is only one activesheet in a workbook, so you can get it simply by

Set ws = Activesheet

but you could just as easily use use ACtivesheet in your code directly.

You may be thinking of selected sheets, which is accessed like

For Each ws In Activewindow.SelectedSheets
...
Next ws

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Simon Shaw" wrote in message
...
I want to set the variable ws similar to the For statement, but I want to

set it for just the current active sheet.

Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets

please help this is not working:

ws = ActiveSheets