ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving Data for future use (https://www.excelbanter.com/excel-programming/337023-saving-data-future-use.html)

Walter Steadman[_2_]

Saving Data for future use
 
Trying to make a pay stub to keep track of Year to Date earnings. But what
I am looking to do is have a sheet in Excel with the following:

Rate: Hourly Rate in Dollars
Hours: #hours worked in time period
Total: Rate * Hours Dollar amount.

While that is simple here is the sticking point.

Would like to have only one line for entry so This week, I input hourly rate
(10.00) and Hours worked (20 hours) and come up with Total of: 200.00

YTD totals would be in cell A1 for Hours worked and cell A2 for the Total
hours income YTD
Rate is in A3
Hours is in B3
Total is in C3 (calculated by A3*B3)

When I open the file next week. It will show in cell A1: 20 for hours
worked and in cell A2: 200.00 for total earned

When I input my new hours example (overwriting the totals from last week:
A3: 10.00
B3: 15
C3: total of A3*B3 so 1.50.00

I would like Cell A1 to show 35 hours worked (total of both weeks) and cell
A2 to show 350.00 total of both weeks)

Is there a on open event I can do to have the numbers from cell A1 and A2
stored as variables and then when I input the new information it will add
that information together with the variables to create a running YTD one
page spreadsheet? I know that I won't be able to retrieve the previous data
and I am trying to get the guy asking for this to reconsider, but in lieu of
his reconsidering I am trying to find him a solution.

TIA

--
Wally Steadman
US Army in Iraq



Bob Phillips[_6_]

Saving Data for future use
 
Walter,

I think this is what you mean

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Address = "$B$3" Then
Range("A1").Value = Range("A1").Value + .Value
Range("A2").Value = Range("A2").Value + Range("C3").Value
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Walter Steadman" wrote in message
...
Trying to make a pay stub to keep track of Year to Date earnings. But

what
I am looking to do is have a sheet in Excel with the following:

Rate: Hourly Rate in Dollars
Hours: #hours worked in time period
Total: Rate * Hours Dollar amount.

While that is simple here is the sticking point.

Would like to have only one line for entry so This week, I input hourly

rate
(10.00) and Hours worked (20 hours) and come up with Total of: 200.00

YTD totals would be in cell A1 for Hours worked and cell A2 for the Total
hours income YTD
Rate is in A3
Hours is in B3
Total is in C3 (calculated by A3*B3)

When I open the file next week. It will show in cell A1: 20 for hours
worked and in cell A2: 200.00 for total earned

When I input my new hours example (overwriting the totals from last week:
A3: 10.00
B3: 15
C3: total of A3*B3 so 1.50.00

I would like Cell A1 to show 35 hours worked (total of both weeks) and

cell
A2 to show 350.00 total of both weeks)

Is there a on open event I can do to have the numbers from cell A1 and A2
stored as variables and then when I input the new information it will add
that information together with the variables to create a running YTD one
page spreadsheet? I know that I won't be able to retrieve the previous

data
and I am trying to get the guy asking for this to reconsider, but in lieu

of
his reconsidering I am trying to find him a solution.

TIA

--
Wally Steadman
US Army in Iraq






All times are GMT +1. The time now is 08:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com