SUM Inputted Values from VBA in Separate Cell

Unlucky-Phase

New Member
Joined
Sep 23, 2019
Messages
14
Hello,

Just looking for some help with the following. I have a table with 3 columns. First is yesterdays date, second is an inputted value say 20 from another sheet, third is a inputted value from another sheet say 40, and the fourth = second+third so should be 60.
The values will change. So I just need to update the last empty cell each time. Although I can't seem to get SUM working for the last two cells in Column C6 & D6. Has to start from 6 as there are gaps before in the sheet that it will try to fill. Any help would be appreciated.

VBA Code:
Range("B6").End(xlDown).Offset(1, 0).Value = Date - 1

Range("C6").End(xlDown).Offset(1, 0).Value = Sheets("Tracker").Range("E4").Value
Range("D6").End(xlDown).Offset(1, 0).Value = Sheets("Tracker").Range("D4").Value

Range("E6").End(xlDown).Offset(1, 0).Value = Application.Sum(Sheets("Tracker").Range("D4").Value, Sheets("Tracker").Range("E4").Value)
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
How about

VBA Code:
Sub test()
  Dim lr As Long
  lr = Range("B" & Rows.Count).End(3).Row + 1
  If lr < 6 Then lr = 6
  With Sheets("Tracker")
    Range("B" & lr).Value = Date - 1
    Range("C" & lr).Value = .Range("E4").Value
    Range("D" & lr).Value = .Range("D4").Value
    Range("E" & lr).Value = .Range("E4").Value + .Range("D4").Value
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,379
Messages
6,119,190
Members
448,874
Latest member
Lancelots

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top