Sean,
Set WS = Worksheets("'whatever")
WS. "whatever"
No. The WS variable already refers to the sheet named "whatever". That what
the Set statement does. Once have the WS variable pointing to the
appropriate sheet, use WS where you would normally use ActiveSheet or
Worksheets("Whatever"). E.g.,
Set WS = Worksheets("'whatever")
WS.Range("A1").Value = 1234
This puts the value 1234 in cell A1 of whatever sheet WS is refering to.
Recording a macro is the easiest way to see what properties and methods are
used, but the code it produces is not pretty bad (mainly because it cannot
anticipate what you are going to do in the next step). It uses Select and
Selection. Use the methods (e..g, Sort) or properties (e.g, Bold), but
create variables for the objects in question. E.g., rather than
Range("A1").Select
Selection.Font.Bold = True
use code like
Range("A1").Font.Bold = True
or
Dim Rng As Range
Set Rng = Range("A1")
Rng.Font.Bold = True
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)