Hello EMoe,
Here is a macro that will update all of the entries when the button is pushed. You will need to add a button to your worksheet and then copy and paste the code into the button's macro code section. If you don't know how to do this, I'll give you instructions to walk you through it.
This macro assumes your worksheets are named "Sheet1" and "Sheet2". The names on both worksheets start at "A1" . If you are using a range or name that is different than what is mentioned, the macro will need to be modified to work properly.
Public Sub UpdateFinances()
Dim Wks1 As Worksheet
Dim Wks2 As Worksheet
Dim NextColumn As Long
Dim Name As String
Dim Amount As Currency
On Error GoTo Problem
Set Wks1 = Excel.Worksheets("Sheet1")
Set Wks2 = Excel.Worksheets("Sheet2")
For R = 1 To Wks1.Range("A" & Rows.Count).End(xlUp).Row
Name = Wks1.Cells(R, "A").Value
Amount = Wks1.Cells(R, "B").Value
For I = 1 To Wks2.Range("A" & Rows.Count).End(xlUp).Row
If Name = Wks2.Cells(I, "A").Value Then
NextColumn = Wks2.Cells(I, Columns.Count).End(xlToLeft).Row + 1
Wks2.Cells(I, NextColumn).Value = Amount
End If
Next I
Next R
Exit Sub
Problem:
Msg = "An Error has Occurred in this Macro." & vbCrLf
Msg = Msg & " Number " & Err.Number & vbCrLf
Msg = Msg & " " & Err.Description
MsgBox Msg, vbCritical + vbOKOnly, "Update Finances"
Err = 0
End Sub
Sincerely,
Leith Ross
Bookmarks