Hi Experts,
I would like a way to keep the cell formatting from the conditional formatting performed before this range is copied.
I don't need the conditional formatting rules on the copied to sheet (email order version). just want it to appear the same as the original.
Is there a way to delete just the rules but keep the formatting?
Main area of issue is where i delete columns if they don't contain certain criteria, and i have conditional formatting set on values in a different cell.
Here's my code. Thanks for the help.
Sub MyDeleteColumns()
Dim lc As Long
Dim c As Long
Dim lr As Long
Application.ScreenUpdating = False
' Copy data from one sheet to other
Sheets("Order Template").Range("A27:F47,I27:I47,L27:M47,Q27:AF47").Copy Sheets("Email order version").Range("A14")
' Autofit columns
Sheets("Email order version").Activate
Columns("T:Y").AutoFit
' Find last column in row 1 with data (last header)
Sheets("Email order version").Activate
lc = Cells(17, Columns.Count).End(xlToLeft).Column
' Loop through all columns
For c = lc To 10 Step -1
' Check to see if last row in column is 17
If Cells(Rows.Count, c).End(xlUp).Row = 17 Then
' Delete column
Columns(c).Delete
End If
Next c
Application.ScreenUpdating = True
End Sub
I would like a way to keep the cell formatting from the conditional formatting performed before this range is copied.
I don't need the conditional formatting rules on the copied to sheet (email order version). just want it to appear the same as the original.
Is there a way to delete just the rules but keep the formatting?
Main area of issue is where i delete columns if they don't contain certain criteria, and i have conditional formatting set on values in a different cell.
Here's my code. Thanks for the help.
Sub MyDeleteColumns()
Dim lc As Long
Dim c As Long
Dim lr As Long
Application.ScreenUpdating = False
' Copy data from one sheet to other
Sheets("Order Template").Range("A27:F47,I27:I47,L27:M47,Q27:AF47").Copy Sheets("Email order version").Range("A14")
' Autofit columns
Sheets("Email order version").Activate
Columns("T:Y").AutoFit
' Find last column in row 1 with data (last header)
Sheets("Email order version").Activate
lc = Cells(17, Columns.Count).End(xlToLeft).Column
' Loop through all columns
For c = lc To 10 Step -1
' Check to see if last row in column is 17
If Cells(Rows.Count, c).End(xlUp).Row = 17 Then
' Delete column
Columns(c).Delete
End If
Next c
Application.ScreenUpdating = True
End Sub