Code to delete rows, add date and loop

Hi, i have attached a ss where i need some code to do the following with the three tabs highlighted green

(1) delete the first 3/4 rows so my headings are on the row 1
(2) Add a column named "Date" in Col AO and put in the current month in format mmm-yy

Loop through the three tabs highlightyed green doing the same

Thanks
LoopingSheetsCode.xlsx
Seamus2626Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try

Sub Macro1()
'
' Macro1 Macro
'


For Each sh In ThisWorkbook.Sheets
    If sh.Tab.Color = 5296274 Then
        sh.Activate
        Set Found = Range("A:A").Find("MasterGroup Name")
        Range(Range("A1"), Found.Offset(-1)).EntireRow.Delete
        With Range("AO1")
            .Value = "Date"
            .Interior.Color = vbRed
            .Font.Color = vbWhite
            .Font.Bold = True
            .HorizontalAlignment = xlCenter
            .EntireColumn.NumberFormat = "MMM-yy"
        End With
    End If
Next
    

End Sub

Open in new window

Regards
0
Seamus2626Author Commented:
Rgonzo, that looks great but i must note that i only coloured the sheets green, going forward they would have to referred to explicitly by their name!

Thanks
0
Rgonzo1971Commented:
No problem

Sub Macro1()
'
' Macro1 Macro
'


For Each sh In ThisWorkbook.Sheets
    Select Case sh.Name
        Case "Incountry", "Inbound", "Outbound"
            sh.Activate
            Set Found = Range("A:A").Find("MasterGroup Name")
            Range(Range("A1"), Found.Offset(-1)).EntireRow.Delete
            With Range("AO1")
                .Value = "Date"
                .Interior.Color = vbRed
                .Font.Color = vbWhite
                .Font.Bold = True
                .HorizontalAlignment = xlCenter
                .EntireColumn.NumberFormat = "MMM-yy"
            End With
        Case Else ' Nothing
    End Select
Next
    

End Sub

Open in new window

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Seamus2626Author Commented:
Hey Rgonzo,

The code is jumping straigh to Case Else?

Is that running fine for you?

Thanks
0
Rgonzo1971Commented:
Running fine by me

Let's try

on your example I've inserted the code

Regards
0
Seamus2626Author Commented:
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.