EliseFreedman
Programmer
Hi All
I am trying to write code that will clear all previous responses in all the worksheets in a workbook. My code would work fine except for the fact that the ranges contain merged cells so the code is breaking at the merged cells. Is there any way in which I can skip the cell if it is merged?
my code is as follows
I am trying to write code that will clear all previous responses in all the worksheets in a workbook. My code would work fine except for the fact that the ranges contain merged cells so the code is breaking at the merged cells. Is there any way in which I can skip the cell if it is merged?
my code is as follows
Code:
Dim wkSht As Worksheet
For Each wkSht In Worksheets
If (Left(wkSht.Name, 1) = "S") Then
'only run if sheet name starts with an "S"
wkSht.Range("E2:E30,F2:F30").ClearContents
End If
'edit ranges to suit max row & cols to exclude (eg cols D,E in above
Next wkSht
End Sub