Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Format for Blank Cells LSG Excel Worksheet Functions 5 March 18th 10 09:59 PM
Maximum Number of Blank Cells between Non Blank Cells in a Range Mal Excel Worksheet Functions 5 November 3rd 07 08:21 AM
Conditional formatting: format when range of cells are blank ChadBellan Excel Discussion (Misc queries) 1 May 25th 07 06:24 PM
Blank Cells - conditioning format seanrigby Excel Discussion (Misc queries) 5 May 9th 06 05:08 PM
How do I make a blank cell with a date format blank? Pivot Table/Query Excel Worksheet Functions 6 June 14th 05 11:19 PM


All times are GMT +1. The time now is 07:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"