![]() |
Setting a range on a particular sheet
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. |
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. |
Setting a range on a particular sheet
Thanks Tom, still not sure why my syntax did not work but yours works fine.
Cheers John "Tom Ogilvy" wrote: 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. |
All times are GMT +1. The time now is 12:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com