Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Disable Button

Hi, can anyone help me with a problem using excel macros?

I have a macro that will take away numbers from a value
that is provided in Cell A1. The problem is that when the
cell reaches Zero i would like to stop the button from
working. Because at the moment all i get is A1 going into
minus figures and that makes the rest of the spreadsheet
go wrong.

Thanks for looking.

Pete
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Disable Button

Private Sub CommandButton1_Click()
if isnumeric(Range("A1").Value) then
if Range("A1").Value -1 < 0 then
Range("A1").Value = 0
CommandButton1.Enabled = False
Else
Range("A1").Value = Range("A1").Value - 1
End if
End if
End Sub

--
Regards,
Tom Ogilvy


"Pete" wrote in message
...
Hi, can anyone help me with a problem using excel macros?

I have a macro that will take away numbers from a value
that is provided in Cell A1. The problem is that when the
cell reaches Zero i would like to stop the button from
working. Because at the moment all i get is A1 going into
minus figures and that makes the rest of the spreadsheet
go wrong.

Thanks for looking.

Pete



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Disable Button

Pete,
Put a qualifier in the loop that subtracts the numbers so the macro will
end.
If Range ("A1").value=0 Then
Exit Sub


"Pete" wrote in message
...
Hi, can anyone help me with a problem using excel macros?

I have a macro that will take away numbers from a value
that is provided in Cell A1. The problem is that when the
cell reaches Zero i would like to stop the button from
working. Because at the moment all i get is A1 going into
minus figures and that makes the rest of the spreadsheet
go wrong.

Thanks for looking.

Pete



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Disable Button

Thank you very much for your replys thats helped me alot.
Thanks!


-----Original Message-----
Hi, can anyone help me with a problem using excel macros?

I have a macro that will take away numbers from a value
that is provided in Cell A1. The problem is that when

the
cell reaches Zero i would like to stop the button from
working. Because at the moment all i get is A1 going

into
minus figures and that makes the rest of the spreadsheet
go wrong.

Thanks for looking.

Pete
.

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
Disable the save button leerem Excel Discussion (Misc queries) 4 December 10th 08 01:06 PM
Disable X button on excel pano Excel Worksheet Functions 6 March 28th 07 02:15 AM
Disable Close Button dan Excel Discussion (Misc queries) 5 September 22nd 06 07:39 PM
Disable Exit button on a UserForm Noemi Excel Discussion (Misc queries) 1 September 14th 06 09:37 PM
How do you disable the Collate button? Trixie Excel Discussion (Misc queries) 0 August 25th 06 04:00 PM


All times are GMT +1. The time now is 11:08 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"