Forum Discussion

A_SIRAT's avatar
A_SIRAT
Iron Contributor
Oct 18, 2023

Please help with a simple VBA Macro

Hi,   I have a file that I would like to have a macro that will clear the contents of cells E18:F19 on all the sheets except the first sheet named " Action". I have sampled two sheets but they coul...
  • HansVogelaar's avatar
    Oct 18, 2023

    A_SIRAT 

    Like this:

    Sub ClearData()
        Dim wsh As Worksheet
        Application.ScreenUpdating = False
        For Each wsh In Worksheets
            Select Case wsh.Name
                Case "Action"
                    ' Skip sheet
                Case Else
                    wsh.Range("E18:F19").ClearContents
            End Select
        Next wsh
        Application.ScreenUpdating = True
    End Sub

Resources