P
(PeteCresswell)
This works - but I know now that it's bad practice:
----------------------------------------------------------------------
4002 Dim myCosmeticRange As Excel.Range
5420 With theSS.Worksheets(theDataSheetName)
5424 Set myCosmeticRange = .Range(.Cells(3, 10), .Cells(5,22)
5426 End With
5429 myCosmeticRange.Select
5430 With theSS.Selection
5431 .Borders(xlEdgeTop).Weight = xlThick
5432 .Borders(xlEdgeTop).LineStyle = xlContinuous
5433 .Borders(xlEdgeTop).ColorIndex = xlAutomatic
5469 End With
----------------------------------------------------------------------
Seems like this should work, but the compiler doesn't buy the first line:
----------------------------------------------------------------------
5420 With theSS.Worksheets(theDataSheetName).Range(.Cells(3, 10), .Cells(5,22)
5431 .Borders(xlEdgeTop).Weight = xlThick
5432 .Borders(xlEdgeTop).LineStyle = xlContinuous
5433 .Borders(xlEdgeTop).ColorIndex = xlAutomatic
5439 End with
----------------------------------------------------------------------
I'm guessing I have the right idea - make the references to an object - but
what's the right syntax?
----------------------------------------------------------------------
4002 Dim myCosmeticRange As Excel.Range
5420 With theSS.Worksheets(theDataSheetName)
5424 Set myCosmeticRange = .Range(.Cells(3, 10), .Cells(5,22)
5426 End With
5429 myCosmeticRange.Select
5430 With theSS.Selection
5431 .Borders(xlEdgeTop).Weight = xlThick
5432 .Borders(xlEdgeTop).LineStyle = xlContinuous
5433 .Borders(xlEdgeTop).ColorIndex = xlAutomatic
5469 End With
----------------------------------------------------------------------
Seems like this should work, but the compiler doesn't buy the first line:
----------------------------------------------------------------------
5420 With theSS.Worksheets(theDataSheetName).Range(.Cells(3, 10), .Cells(5,22)
5431 .Borders(xlEdgeTop).Weight = xlThick
5432 .Borders(xlEdgeTop).LineStyle = xlContinuous
5433 .Borders(xlEdgeTop).ColorIndex = xlAutomatic
5439 End with
----------------------------------------------------------------------
I'm guessing I have the right idea - make the references to an object - but
what's the right syntax?