I am trying to create a button that when you click it it will delete all data
in a workbook. Anyone have any ideas???
I am trying to create a button that when you click it it will delete all data
in a workbook. Anyone have any ideas???
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim r As Range
For Each ws In Worksheets
ws.Activate
For Each r In ws.UsedRange
MsgBox r
Next r
Next
End Sub
So do I need to create a command button?
"arthurjr07@gmail.com" wrote:
> Private Sub CommandButton1_Click()
> Dim ws As Worksheet
> Dim r As Range
> For Each ws In Worksheets
> ws.Activate
> For Each r In ws.UsedRange
> MsgBox r
> Next r
> Next
> End Sub
>
>
Go to TOOLS>MACRO>Visual Basic Editor
then Right Click on VBAProjects on the project window then Insert >
UserForm
On the user form, insert a commandbutton
copy and paste the code and then run
I hope u understand what i am trying to say
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks