Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA dynamically format Row1
Hello All -
Thanks in advance for any help. Background info: Excel 2003 Sp1 I am trying to create a macro\subroutine to format the first row in a spreadsheet. Of course I can get the formatting syntax by recording a macro as I format. The problem is dynamically identifying the last column used. I'd like to use this macro for all of my spreadsheets so the number of columns will vary. For example; spreadsheet1 A1=FirstName B1=LastName C1=SS# spreadsheet2 A1=Category B1=SubCategory So running the macro in either spreadsheet would set the background to gray, bold, horizontal, wordwrap, etc just for the columns that contain data. In spreadsheet 1 that would be 3 cells (A1,B1,C1) and spreadsheet 2 2 cells(A1,B1). If you can provide a snip-it of code that would be appreciated. Thanks in advance, Liz |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA dynamically format Row1
Set rng = Range("A1").Resize(,Cells(1,Columns.Count).End(xlT oLeft).Column) then just format using the variable rng object. -- HTH RP (remove nothere from the email address if mailing direct) "Liz" wrote in message ... Hello All - Thanks in advance for any help. Background info: Excel 2003 Sp1 I am trying to create a macro\subroutine to format the first row in a spreadsheet. Of course I can get the formatting syntax by recording a macro as I format. The problem is dynamically identifying the last column used. I'd like to use this macro for all of my spreadsheets so the number of columns will vary. For example; spreadsheet1 A1=FirstName B1=LastName C1=SS# spreadsheet2 A1=Category B1=SubCategory So running the macro in either spreadsheet would set the background to gray, bold, horizontal, wordwrap, etc just for the columns that contain data. In spreadsheet 1 that would be 3 cells (A1,B1,C1) and spreadsheet 2 2 cells(A1,B1). If you can provide a snip-it of code that would be appreciated. Thanks in advance, Liz |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA dynamically format Row1
Thanks in advance for any help. Background info: Excel 2003 Sp1
I am trying to create a macro\subroutine to format the first row in a spreadsheet. Of course I can get the formatting syntax by recording a macro as I format. The problem is dynamically identifying the last column used. I'd like to use this macro for all of my spreadsheets so the number of columns will vary. ------------- LastCol = ActiveSheet.Cells(1, Application.Columns.Count).End(xlToLeft).Column |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dynamically update label axis *format* without VBA? (03 and 07) | Charts and Charting in Excel | |||
How to change the row1 content of the existing excel file automically | Excel Worksheet Functions | |||
How to get row2 value into row1 in calculated Field Column in pivo | Excel Discussion (Misc queries) | |||
Is It Possible To Dynamically Name Series? | Charts and Charting in Excel | |||
Sum columns dynamically | Excel Worksheet Functions |