View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Setting a range on a particular sheet

With worksheets("Name of sheet")
set myRange = .Range(.Cells(1, colNum), .Cells(50,colNum))
End With

--
Regards,
Tom Ogilvy

"JLX" wrote in message
...
I am trying to compare the column widths between 2 sheets. If they differ

one
of the sheets will have the column bordered in red using the borderaround
method.
However the button to initiate the comparison is on a third sheet and the
border always appears on this sheet. Have tried activating the sheet prior

to
defining the range. Code as follows
set myRange = worksheets("Name of sheet").Range(Cells(1, colNum),

Cells(50,
colNum)) does not work although the help suggests it should work.