![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
Hi all. What I am trying to do is have a comand buton on Sheet1, clear a range on sheet 2. This is what I have and it dont seam to work. (button in sheet1)
Private Sub Cmd1_Click() Sheets("Sheet2").Select Range("A1:D12").Select Selection.ClearContents Range("A1").Select End End Sub I also tryed the same thing with a dbase query, and it does the same thing. As long as I run the button from the same sheet that I want to import the data too, everything is fine. But when running the comand from another worksheet,In the same workbook I end up with errors. Thx for your help Dan |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: New York
Posts: 71
|
Try appending Sheets("Sheet2") in front of each line, and don't change sheets:
Private Sub Cmd1_Click() Sheets("Sheet2").Range("A1:D12").ClearContents End Sub |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
Ok will try Thx again Bob, Have a good evening !
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
Works Great Bob, Thx for your time !
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|