O
ordnance1
Can anyone tell me why my code below only deletes data from worksheet April
and not all of the selected worksheets? I intend that the TextBox1 value be
found on all selected worksheets and be replaced by nothing, in effect
removing the data from all worksheets.
Private Sub CommandButton1_Click()
x = TextBox1.Value
If ActiveSheet.Name = "April" Then
Sheets(Array("April", "May", "June", "July", "August",
"September")).Select
Cells.Replace What:=x, Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Sheets("April").Select
End If
Unload UserForm1
End Sub
and not all of the selected worksheets? I intend that the TextBox1 value be
found on all selected worksheets and be replaced by nothing, in effect
removing the data from all worksheets.
Private Sub CommandButton1_Click()
x = TextBox1.Value
If ActiveSheet.Name = "April" Then
Sheets(Array("April", "May", "June", "July", "August",
"September")).Select
Cells.Replace What:=x, Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Sheets("April").Select
End If
Unload UserForm1
End Sub