Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Sige,
I think the code should be as follows: If LastCol 8 Then Set rng2 = Range("A1", Cells(2, LastCol)) The thing is that the UsedRange can change while working on the sheet ... Worksheet_SelectionChange might be a solution to update this behaviour...& Also ressetting the UsedRange. I am afraid though that this will invoke emptying the Undo-list! If your purpose is to set the black background / white font for rows 1:2, why bother to monitor the number of columns in the used range? In the absence of definitive information, make an informed guess: With Range("A1:Z2") .Interior.ColorIndex = 1 .Font.ColorIndex = 2 End With --- Regards, Norman "Sige" wrote in message ups.com... Hi Norman, The black cells I am coloring should indicate how wide (wide) the last column is going of my UsedRange ... always coloring row 1 & 2.(titles will be written in here) I think the code should be as follows: If LastCol 8 Then Set rng2 = Range("A1", Cells(2, LastCol)) The thing is that the UsedRange can change while working on the sheet ... Worksheet_SelectionChange might be a solution to update this behaviour...& Also ressetting the UsedRange. I am afraid though that this will invoke emptying the Undo-list! Way around? Brgds Sige |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formatting a two-variable data table | Excel Worksheet Functions | |||
Conditional Formatting using variable text | Excel Discussion (Misc queries) | |||
Stuffing Numeric Variable Values into Footnote with formatting | Excel Programming | |||
Formatting a Variable | Excel Programming | |||
How to copy formatting when moving from cell to variable to another cell on another worksheet | Excel Programming |