K
Kenny
I have the following macro that fillsdown specific columns with formats,
validations, etc. I had to use seperate techniques because I couln not figure
out how to copy an entire row's formats, validations, and formulas without
carring other columns in that rows VALUE data with it (columns without
formats, validations or formulas - data only). This code works good, however,
I am still adding new columns as I see fit. Of course then I have to change
the references in the code when needed. One is there a way to supress columns
with values and copy the row's formats, validations, and formulas only. If
not, is there a way I can scan my column headers in row 1 in each column to
locate the header of choice and then apply my code to the column. This would
prevent having to change the references each time I move a column. Thanks!
Dim lastRow As Long
lastRow = Range("AD65536").End(xlUp).Row
Range("A3:B3").AutoFill Destination:=Range("A3:B" & lastRow)
Range("C3:E3").AutoFill Destination:=Range("C3:E" & lastRow),
Type:=xlFillFormats
Range("I3").Copy
Range("I3:I" & lastRow).PasteSpecial Paste:=xlPasteValidation
Range("K3:L3").AutoFill Destination:=Range("K3:L" & lastRow)
Range("M3:O3").Copy
Range("M3:O" & lastRow).PasteSpecial Paste:=xlPasteValidation
Range("P3:Q3").AutoFill Destination:=Range("P3:Q" & lastRow)
Range("R3:T3").Copy
Range("R3:T" & lastRow).PasteSpecial Paste:=xlPasteValidation
'Range("A3:A" & lastRow) = Range("A3").FormulaArray
Application.ScreenUpdating = True
Sheets("Tracker").Range("A2").Select
End Sub
validations, etc. I had to use seperate techniques because I couln not figure
out how to copy an entire row's formats, validations, and formulas without
carring other columns in that rows VALUE data with it (columns without
formats, validations or formulas - data only). This code works good, however,
I am still adding new columns as I see fit. Of course then I have to change
the references in the code when needed. One is there a way to supress columns
with values and copy the row's formats, validations, and formulas only. If
not, is there a way I can scan my column headers in row 1 in each column to
locate the header of choice and then apply my code to the column. This would
prevent having to change the references each time I move a column. Thanks!
Dim lastRow As Long
lastRow = Range("AD65536").End(xlUp).Row
Range("A3:B3").AutoFill Destination:=Range("A3:B" & lastRow)
Range("C3:E3").AutoFill Destination:=Range("C3:E" & lastRow),
Type:=xlFillFormats
Range("I3").Copy
Range("I3:I" & lastRow).PasteSpecial Paste:=xlPasteValidation
Range("K3:L3").AutoFill Destination:=Range("K3:L" & lastRow)
Range("M3:O3").Copy
Range("M3:O" & lastRow).PasteSpecial Paste:=xlPasteValidation
Range("P3:Q3").AutoFill Destination:=Range("P3:Q" & lastRow)
Range("R3:T3").Copy
Range("R3:T" & lastRow).PasteSpecial Paste:=xlPasteValidation
'Range("A3:A" & lastRow) = Range("A3").FormulaArray
Application.ScreenUpdating = True
Sheets("Tracker").Range("A2").Select
End Sub