LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Can't select macro button after other button is pressed

If you want to get rid of these problems use a shape or a button from the
forms menu.

this might be a bit more efficient. NO selections and one line if

vAnswer = MsgBox("This will erase all your data but not the
formulas.Continue?", vbYesNo)
If vAnswer = vbYes Then Range("OTDataEntry").Clear

--
Don Guillett
SalesAid Software

"C. Campbell" wrote in message
m...
I have a workbook with two sheets. There is a button on each sheet
with code to erase a named range without deleting areas that aren't
included in the range.

If I press a button, the code executes OK. Then when I go to the
other sheet I can't press the second button. Also, sometimes I can't
select it in design mode. Actually, I can select the button but when
I right-click it and select "Properties", it gives me the sheet
properties instead of the button properties.

What am I doing wrong?

Here is the button code:

Sub CommandButton1_Click()
'Erase data in Overtime Report sheet

vAnswer = msgbox("This will erase all your data but not the formulas.
Continue?", vbYesNo)

If vAnswer = vbYes Then
Application.Goto Reference:="OTDataEntry"
Selection.ClearContents
End If

Range("A1").Select
Range("E7").Select

End Sub
------------------------------------------
Sub CommandButton2_Click()
'Erase data in HOURS sheet

vAnswer = msgbox("This will erase all your data but not the formulas.
Continue?", vbYesNo)

If vAnswer = vbYes Then
Application.Goto Reference:="DataEntry"
Selection.ClearContents
End If

Range("A1").Select
Range("G3").Select

End Sub



 
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
preventing button being pressed Mike Excel Discussion (Misc queries) 2 March 16th 06 03:47 PM
TRAPPING PRESSED BUTTON jason Excel Programming 1 August 11th 04 01:33 PM
Message box display or something in the status area after macro button is pressed? StargateFan[_3_] Excel Programming 5 May 16th 04 09:04 PM
Which button was pressed? Adrian[_4_] Excel Programming 7 April 28th 04 04:55 PM
Errormessage when button is pressed twice or more Pointerman Excel Programming 4 April 7th 04 03:56 PM


All times are GMT +1. The time now is 10:25 PM.

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

About Us

"It's about Microsoft Excel"