Forum Discussion
Excel
Jan 27, 2021Iron Contributor
Problem related to Repititive format with header
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...???
2 Replies
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- ExcelIron Contributor
It worked... Thank you so much sir😊😊