Hi
I have a macro which clears data from cells A2 to H50,000.
However, I would like to add a warning message which asks the user if they're sure they want to proceed with the action.
If 'yes' then it proceeds, if 'No,' then nothing happens. My code is below with 'comment' additions of what I'd like to do.
Can someone please help? Thanks in advance.
Sub ClearDataFromCSVtab()
'Clears contents from columns A to H (below the titles) in the CSV data tab up to row 50,000
'MsgBox "Are you sure you want to clear the data in this tab?"
'If - answer is 'No' then nothing
else if
End If
ThisWorkbook.ActiveSheet.Range("A2:H50000").ClearContents
MsgBox "Data has been cleared"
End Sub
I have a macro which clears data from cells A2 to H50,000.
However, I would like to add a warning message which asks the user if they're sure they want to proceed with the action.
If 'yes' then it proceeds, if 'No,' then nothing happens. My code is below with 'comment' additions of what I'd like to do.
Can someone please help? Thanks in advance.
Sub ClearDataFromCSVtab()
'Clears contents from columns A to H (below the titles) in the CSV data tab up to row 50,000
'MsgBox "Are you sure you want to clear the data in this tab?"
'If - answer is 'No' then nothing
else if
End If
ThisWorkbook.ActiveSheet.Range("A2:H50000").ClearContents
MsgBox "Data has been cleared"
End Sub