Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello!
Thanks for taking the time to look at this help request. This is the last bit to complete my first Excel project involving VBA! I basically have a button which fires up a macro with a VBA input box into which users are invited to enter an 8 digit code. What I need to do is to say 'If the code entered is the same as the number in Sheet1!A1 then delete the button. If it's not the same as Sheet1!A1 then give a 'that is not the right code' message and stop. Looking at what you guys are writing about I know this should be easy, but I've not yet reached that place where it all starts to click together and self generate. Any advice on books etc that will help me get there? Thanks again...I appreciate your help. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
CommandButton from the Control Toolbox Toolbar
Private Sub CommandButton1_Click() res = InputBox("Enter 8 Digit Number:") If CLng(res) = Worksheets("Sheet1").Range("A1").Value Then Application.OnTime Now, "Deletebutton" Else MsgBox "Number is incorrect" End If End Sub Code above should go in the sheet module where the button is located. In a general module put this code: Sub DeleteButton() Worksheets("sheet1") _ .OLEObjects("Commandbutton1").Delete End Sub Commandbutton should be named CommandButton1 - both the name property and the OleObject name. Of course if the workbook is not saved after the delete, the next time you open it the button will be back. -- Regards, Tom Ogilvy Big Chris wrote in message ... Hello! Thanks for taking the time to look at this help request. This is the last bit to complete my first Excel project involving VBA! I basically have a button which fires up a macro with a VBA input box into which users are invited to enter an 8 digit code. What I need to do is to say 'If the code entered is the same as the number in Sheet1!A1 then delete the button. If it's not the same as Sheet1!A1 then give a 'that is not the right code' message and stop. Looking at what you guys are writing about I know this should be easy, but I've not yet reached that place where it all starts to click together and self generate. Any advice on books etc that will help me get there? Thanks again...I appreciate your help. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
aesthetics (how might I make it look pretty) | Excel Discussion (Misc queries) | |||
Pretty simple question | Excel Discussion (Misc queries) | |||
Pretty Buttons... | Excel Discussion (Misc queries) | |||
I think this should be pretty simple... | Excel Discussion (Misc queries) | |||
Went to your site pretty cool! | New Users to Excel |