Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Creating a Button to add to existing values while subtracting range

Greetings Programers,

I have be looking for some samples of how to use a button with a macro to add a value (let's say minutes) entered in cell A1.

Which upon clicking the button adds the value in A1 to an existing value of (mins.) to cell A2.

Once the total in A2 is updated, range (A3:F3) of positive values are subtracted and the results are displayed in cell B1(Mins. remaining).

I know this should be a simple one. But being new to VB, I need some help on this one. I thought I saw an example of this somewhere but can't locate it.

Thank in advance,
Chris A. Z.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Creating a Button to add to existing values while subtracting range

Hi Chris,

Off the top

Private Sub CommandButton1_Click()
Dim cell As Range
Range("A2").Value = Range("A1").Value
Range("B1").Value = Range("A2").Value
For Each cell in Range("A3:F3")
If cell.Value 0 Then
Range("B1").Value = Range("B1").Value - cell.Value
End If
Next cell
End Sub

But why not just do it with worksheet formula?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"C. A. Zan" wrote in message
...
Greetings Programers,

I have be looking for some samples of how to use a button with a macro to

add a value (let's say minutes) entered in cell A1.

Which upon clicking the button adds the value in A1 to an existing value

of (mins.) to cell A2.

Once the total in A2 is updated, range (A3:F3) of positive values are

subtracted and the results are displayed in cell B1(Mins. remaining).

I know this should be a simple one. But being new to VB, I need some help

on this one. I thought I saw an example of this somewhere but can't locate
it.

Thank in advance,
Chris A. Z



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
Subtracting two cells-one has existing formula???? duethckey Excel Discussion (Misc queries) 7 October 18th 07 08:10 PM
creating a range reference from cell values Robin Krupp Excel Discussion (Misc queries) 4 August 10th 07 07:49 PM
Creating an column of values from an existing array PA New Users to Excel 1 November 20th 06 12:27 PM
Creating an EXCEL COUNTIF formula for a range of values Pat Walsh Excel Discussion (Misc queries) 5 January 21st 05 02:57 PM
Creating new worksheet from existing ddpen Excel Discussion (Misc queries) 2 December 1st 04 10:35 PM


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