gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,347
- Office Version
- 365
- Platform
- Windows
I have code that is supposed to perform all the way to the last row that has data in column H
But it seems to stops right before the last two rows. So if I have all the way to row 739, its not putting data in 738 or 739 column 13
If I add data to H740 and H741 I get data in column M (13) for 738 and 739.
Help Please. I need it to go to the last row of data
But it seems to stops right before the last two rows. So if I have all the way to row 739, its not putting data in 738 or 739 column 13
If I add data to H740 and H741 I get data in column M (13) for 738 and 739.
Help Please. I need it to go to the last row of data
Code:
ActiveSheet.AutoFilterMode = False
Application.Calculation = xlManual
Sheet11.Activate
Dim ws As Worksheet
Dim st1 As String, st2 As String
Dim a As Long
Dim cont As Long
Set ws = ActiveSheet
cont = Application.WorksheetFunction.CountA(ws.Range("h:h"))
For a = 4 To cont
If ws.Cells(a, 5) = 0 And ws.Cells(a, 7) = 0 Then
ws.Cells(a, 12).Value = 1
ws.Cells(a, 13).Value = 1
End If
If ws.Cells(a, 6) <> "" Then
st1 = ws.Cells(a, 6)
For B = a - 1 To 1 Step -1
st2 = ws.Cells(B, 8)
If st1 = st2 Then
ws.Cells(a, 13) = ws.Cells(a, 12) * ws.Cells(B, 12)
Exit For
End If
Next B
End If
Next a