Sum using Macro?
Closed
Hipty
-
15 Jun 2012 à 06:28
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 16 Jun 2012 à 23:27
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 16 Jun 2012 à 23:27
Related:
- Sum using Macro?
- Run macro in excel - Guide
- How to run a macro in excel - Guide
- How to copy macro from one workbook to another - Guide
- Macro antena apk - Download - Gaming tools
- How to sum days in excel - Guide
1 response
venkat1926
Posts
1863
Registration date
Sunday 14 June 2009
Status
Contributor
Last seen
7 August 2021
811
16 Jun 2012 à 23:27
16 Jun 2012 à 23:27
the sample data is like this
a 1
s 2
d 3
f 4
g 5
h 6
j 7
k 8
total 36
the total in col., B is total of all the data above this row
now try this macro
FIRST copy the sample data on a sheet and copy the macrpo in vb editor and run the macro and check
if it is ok study the macro and your sheet and modify the macro.
if inputbox is 3 then the total will be form B3 to B8.
a 1
s 2
d 3
f 4
g 5
h 6
j 7
k 8
total 36
the total in col., B is total of all the data above this row
now try this macro
Sub test()
Dim x As Integer
x = InputBox("Which row to sum from?")
Cells(x, 2).End(xlDown) = WorksheetFunction.Sum(Range(Cells(x, 2), Cells(x, 2).End(xlDown).Offset(-1, 0)))
End Sub
FIRST copy the sample data on a sheet and copy the macrpo in vb editor and run the macro and check
if it is ok study the macro and your sheet and modify the macro.
if inputbox is 3 then the total will be form B3 to B8.