Format top row, but only non-blank cells
I have a macro that formats reports that I do and have given it to coworkers.
They don't want the "entire" top row highlighted. they only want the cells they are using. The reports we run vary in the number of columns used but the always start at cell A1 and run horizontally and don't skip any cells. These are the column labels. Is there some routine that can detect how many columns are being used and only format those columns in the first row?- instead of formattingthe entire row? Sheets("dbo_Corp10_Demographics_Volume_").Select Rows("1:1").Select With Selection.Interior .ColorIndex = 15 .Pattern = xlSolid |
Format top row, but only non-blank cells
You can use Specialcells
On Error Resume Next Rows("1").SpecialCells(xlCellTypeConstants).Font.B old = True On Error GoTo 0 -- Regards Ron de Bruin http://www.rondebruin.nl "BillyRogers" wrote in message ... I have a macro that formats reports that I do and have given it to coworkers. They don't want the "entire" top row highlighted. they only want the cells they are using. The reports we run vary in the number of columns used but the always start at cell A1 and run horizontally and don't skip any cells. These are the column labels. Is there some routine that can detect how many columns are being used and only format those columns in the first row?- instead of formattingthe entire row? Sheets("dbo_Corp10_Demographics_Volume_").Select Rows("1:1").Select With Selection.Interior .ColorIndex = 15 .Pattern = xlSolid |
Format top row, but only non-blank cells
here's what i did and it works....I took some code i found in an earlier
message and modified it slightly. Sheets("dbo_Corp10_Demographics_Volume_").Select Range("A1", Range("IV1").End(xlToLeft)).Select ''''''''Rows("1:1").Select-----I replaced this line with the one above With Selection.Interior .ColorIndex = 15 .Pattern = xlSolid |
All times are GMT +1. The time now is 05:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com