FranktheBank
Member
Hello again,
I have the attached code which takes Data inputted by Users and does two things:
1) Makes a list of each entry. This part is working.
2) Supposed to take Value based on RC_Number and Add it to a running Total (in this example 'FrankSubtotal', this is where it falls apart. It continuously re saves over existing value.
For example if the User Selects RC_Number 3201 on the first pass and enters a value of $10. Cells AA2 would be filled:3201, Cells AB2 would be filled: Frank and Cells AC2 would be $10. The Cells D9 would have the Value $10.
Now on the next pass if the User selects RC_Number 3201 AGAIN and enters a value of $25. Cells AA3 would be filled:3201, Cells AB3 would be filled: Frank and Cells AC3 would be $25 (this part is working). The Cells D9 should have the Value $35. But I'm getting Cells D9 as $25.
Does anyone see my error??
I have the attached code which takes Data inputted by Users and does two things:
1) Makes a list of each entry. This part is working.
2) Supposed to take Value based on RC_Number and Add it to a running Total (in this example 'FrankSubtotal', this is where it falls apart. It continuously re saves over existing value.
For example if the User Selects RC_Number 3201 on the first pass and enters a value of $10. Cells AA2 would be filled:3201, Cells AB2 would be filled: Frank and Cells AC2 would be $10. The Cells D9 would have the Value $10.
Now on the next pass if the User selects RC_Number 3201 AGAIN and enters a value of $25. Cells AA3 would be filled:3201, Cells AB3 would be filled: Frank and Cells AC3 would be $25 (this part is working). The Cells D9 should have the Value $35. But I'm getting Cells D9 as $25.
Does anyone see my error??
Code:
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub CommandButton1_Click()
Dim lRow As Long
Dim RCol As Long
Dim RNCol As Long
Dim ECol As Long
Dim ws As Worksheet
Set ws = Worksheets("Master")
RCol = 27
RNCol = 28
ECol = 29
If BundleCount.Value = 2 Then 'Saves Second set of Data Entered in Column "AE, AF & AG"
RCol = RCol + 4
RNCol = RNCol + 4
ECol = ECol + 4
End If
If BundleCount.Value > 2 Then ' Saves all Data after Second Set in Columns "AI, AJ, AK..."
RCol = RCol + (4 * (BundleCount.Value - 1))
RNCol = RNCol + (4 * (BundleCount.Value - 1))
ECol = ECol + (4 * (BundleCount.Value - 1))
End If
lRow = ws.Cells(Rows.Count, ECol).End(xlUp).Offset(1, 26).Row
With ws
Debug.Print lRow & ", " & Me.RC_Numbers.Value & ", " & Me.RC_Name.Value & ", " & Me.Expense.Value
' Saves Initial set of Data
.Cells(lRow, RCol).Value = Me.RC_Numbers.Text
.Cells(lRow, RNCol).Value = Me.RC_Name.Value
.Cells(lRow, ECol).Value = Me.Expense.Value
End With
'to save Dollar amount to Frank running Total and update Cell D9
If Me.RC_Numbers.Text = 3201 Then
FrankSubtotal = FrankSubtotal + Expense.Value
Range("D9").Value = FrankSubtotal
End If
RC_Numbers.ListIndex = -1
RC_Name.ListIndex = -1
Expense.Object.Value = ""
End Sub
Private Sub CommandButton3_Click()
RC_Numbers.ListIndex = -1
RC_Name.ListIndex = -1
Expense.Object.Value = ""
End Sub
Private Sub Label1_Click()
.HorizontalAlignment
End Sub
Private Sub NewBundle_Click()
Dim CCol As Long
BundleCount.Value = BundleCount.Value + 1
End Sub
Private Sub RC_Numbers_Change()
If Len(RC_Numbers.Value) > 0 Then
RC_Name.Value = RC_Numbers.Value
End If
End Sub
Private Sub RC_Name_Change()
If Len(RC_Name.Text) <> 0 Then
RC_Numbers.Value = RC_Name.Text
End If
End Sub
Private Sub SpinButton1_Change()
BundleCount.Value = SpinButton1.Value
End Sub
[CODE]