Sum the total value for each row at that column

Alexandro88

New Member
Joined
Nov 11, 2010
Messages
35
Worksheets("Sheet3").Select
With Application.WorksheetFunction

For Each rngcell In Range("M1:M" & Range("A" & Rows.Count).End(xlUp).Row)

If InStr(1, Left(rngcell.Value, 5), "SFET4") Then
vResult = .Sum(Range("J1:J")) + vResult
ElseIf InStr(1, Left(rngcell.Value, 5), "SFET3") Then
zResult = .Sum(Range("J1:J")) + zResult
End If

Next

MsgBox vResult
MsgBox zResult

End With

Hi, my code will stuck at
vResult = .Sum(Range("J1:J")) + vResult

Any1 can help me?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
That's because

Range("J1:J")

isn't a valid range, as you're not identifying the final row
 
Upvote 0

Forum statistics

Threads
1,203,069
Messages
6,053,359
Members
444,657
Latest member
jessejames1of3

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