Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Running Total on Userform

I have a useform, which has many options on it. Each
option selected affects the costs of the project
concerned. This is all taken care of on the worksheets
behind.
What i would like however is to have a box which contains
the running total, so a user could click an option or a
supplier, thn change it to see instantly the difference in
costs.

This value already exists on the worksheet, buti am unable
to keep it 'live' on the userform.

Any ideas?
Thanks
Richard

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Running Total on Userform

Link your textbox to a worksheet cell such as B2. Then use the worksheet
calculate event to update that cell with the running total from the cell
where the running total is calculated (in this example, B1). This will
avoid the linking of the textbox overwriting your formula:

Private Sub Worksheet_Calculate()
On Error goto ErrHandler
Application.EnableEvents = False
Range("B2").Value = Range("B1").Value
ErrHandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy


"Richard" wrote in message
...
I have a useform, which has many options on it. Each
option selected affects the costs of the project
concerned. This is all taken care of on the worksheets
behind.
What i would like however is to have a box which contains
the running total, so a user could click an option or a
supplier, thn change it to see instantly the difference in
costs.

This value already exists on the worksheet, buti am unable
to keep it 'live' on the userform.

Any ideas?
Thanks
Richard



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Running Total on Userform

Hi Richard,

Something like this. I have assumed option buttons, but if it is checkboxes
it is the same principle

Private Sub OptionButton1_Click()
With TextBox1
If OptionButton1.Value = True Then
.Value = .Value + Worksheets("Sheet1").Range("A1").Value
Else
.Value = .Value - Worksheets("Sheet1").Range("A1").Value
End If
.Value = Format(.Value, "£#,##0.00")
End With
End Sub

Private Sub OptionButton2_Click()
With TextBox1
If OptionButton2.Value = True Then
.Value = .Value + Worksheets("Sheet1").Range("A2").Value
Else
.Value = .Value - Worksheets("Sheet1").Range("A2").Value
End If
.Value = Format(.Value, "£#,##0.00")
End With
End Sub

Private Sub UserForm_Initialize()
TextBox1.Value = 0
End Sub

--

HTH

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

"Richard" wrote in message
...
I have a useform, which has many options on it. Each
option selected affects the costs of the project
concerned. This is all taken care of on the worksheets
behind.
What i would like however is to have a box which contains
the running total, so a user could click an option or a
supplier, thn change it to see instantly the difference in
costs.

This value already exists on the worksheet, buti am unable
to keep it 'live' on the userform.

Any ideas?
Thanks
Richard



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
Duplicate Running Total Grand Total In Pivot Table Mathew P Bennett[_2_] Excel Discussion (Misc queries) 1 August 17th 08 03:13 AM
running total and average of that total after 3 events belvy123 Excel Discussion (Misc queries) 0 March 28th 07 02:57 AM
running total and average of that total after 3 events Toppers Excel Discussion (Misc queries) 1 March 28th 07 02:19 AM
How can I use a worksheet while running a userform? Leo Excel Programming 4 December 17th 03 02:58 PM
Closing the Userform when macro is running SuperJas Excel Programming 5 December 10th 03 05:31 AM


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