Jan 27 2021 04:57 AM - edited Jan 27 2021 05:13 AM
Hello,
I am doing macro recorder in MACRO sheet. After recording, Then i create button in TEST MACRO sheet to run that macro.
I press button multiple times so my headers come repeat.
So how to delete headers with the help of VBA code??
I am attach the excel file
Please help..??
Waiting for your reply...???
Jan 27 2021 05:46 AM
Sub HeadersFormat()
'
' HeadersFormat Macro
' Header with format...
'
' Keyboard Shortcut: Ctrl+j
'
Application.ScreenUpdating = False
Do While Range("A2").Value = "EmpID"
Range("A2").EntireRow.Delete
Loop
If Range("A1").Value <> "EmpID" Then
With Range("A1:I1")
.Value = Array("EmpID", "First Name", "Last Name", "Departmant", "ID Name", "Extention", "Location", "Date", "Pay Rate")
With .Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 6299648
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With .Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.Bold = True
End With
End With
Range("E1").ColumnWidth = 8.89
End If
Application.ScreenUpdating = True
End Sub
Jan 27 2021 06:22 AM
It worked... Thank you so much sir:smiling_face_with_smiling_eyes::smiling_face_with_smiling_eyes: