-
Sum the total value for that column
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?
-
Welcome to the forum! It is recommended that you place code inside VBA code tags.
[VBA]vResult = .Sum(Range("J1:J" & rngcell.row))[/VBA]
-
Thank Kenneth. It work.
However, the sum of total value SFET4 and SFET3 will mixed.
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" & rngcell.Row))
ElseIf InStr(1, Left(rngcell.Value, 5), "SFET3") Then
zResult = .Sum(Range("J1:J" & rngcell.Row))
End If
Next
MsgBox vResult
MsgBox zResult
-
Wouldn't a SUMIF work?
What is the result you desire?
-
hi mikerickson,
Thank. I already figure out how to solve that issue.
However, I got another issue.
If i want to search date I manually set with the date in the list. How should i write the code?
Example:
Today : 28/10/2011
In my list got many date:
26/10/2011
27/10/2011
28/10/2011
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules