#1   Report Post  
Posted to microsoft.public.excel.misc
Marcus
 
Posts: n/a
Default Delete Data Button

I am trying to create a button that when you click it it will delete all data
in a workbook. Anyone have any ideas???
  #2   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Delete Data Button

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
Marcus
 
Posts: n/a
Default Delete Data Button

So do I need to create a command button?

" 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


  #4   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Delete Data Button

Go to TOOLSMACROVisual 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:)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I delete a macro when the Delete button is not active? FCR Excel Worksheet Functions 0 March 9th 06 09:43 AM
CHANGE DATA SERIES WITH A COMMAND BUTTON Raymond Willis Charts and Charting in Excel 5 December 5th 05 05:49 PM
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM
Macro to delete data in 'green' cells only Steve Excel Worksheet Functions 7 March 19th 05 01:40 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM


All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"