Hello All!
I sometimes import data from an ERP Program to Excel.
I want to write a Macro which will make the imported data more presentable (For example: draw borders for all the cells, give the heading a fill color etc. etc.). To do this I need to select the heading row.
The problem is that each time there are a different number of columns.
How do I program the macro so that it will color all of the header?
I saw a macro that does this on a pivot table and I want to do thae same on a regular table.
Thanks!!
Automatically Format Header Row
-
-
-
Re: Macro Problem
what row is the header?
-
Re: Macro Problem
The header is row number 1 (#1)
-
-
Re: Macro Problem
Thanks!
-
-
Re: Macro Problem
Quote from Wigi
Hi!
The problem with your soilution is that the entire header row is colored yellow. I want to color only the cells that have data in them. Do you know how to do that? -
Re: Macro Problem
Quote from NoamGHi!
The problem with your soilution is that the entire header row is colored yellow. I want to color only the cells that have data in them. Do you know how to do that?Is this better?
CodeRange("A1", Cells(1, Columns.Count).End(xlToRight)).SpecialCells(xlCellTypeConstants).Interior.ColorIndex = 6
Wigi
-
Re: VBA to format header line with variable number columns
Hi Wigi,
Your solution was excellent!
Thanks a lot man-Noam
-
Re: VBA to format header line with variable number columns
I would apply Conditional Formatting to the whole row with Formula is:
=LEN(A1)>1
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!