Hi guys,
Earlier I had a excel file with many columns.
I wrote a code in Excel VBA to fill up the last two columns according to the data in the other columns of the row.
It worked fine.
Now, the whole thing is transferred to an Access table.
Pls help me convert this Excel VBA code to Access VBA.
Excel 2003 -> Access 2003
Thanks a ton in advance
Earlier I had a excel file with many columns.
I wrote a code in Excel VBA to fill up the last two columns according to the data in the other columns of the row.
It worked fine.
Now, the whole thing is transferred to an Access table.
Pls help me convert this Excel VBA code to Access VBA.
Excel 2003 -> Access 2003
Code:
Sub GeneratePorEngID()
Range("S2:T5000").Clear
Dim PrevTaskID As Integer
Dim intNO As Long
Dim intCount As Integer
intNO = 1
PrevTaskID = 1
For i = 2 To 5000
'If PrevTaskID = 1 Then intNO = 1
If Cells(i, "J") <> "" Then
If PrevTaskID = Cells(i, "J") Then
Cells(i, "S") = intNO
intNO = intNO + 1
intCount = intCount + 1
Else
For j = i - intCount - 1 To i - 1
Cells(j, "T") = intNO
intNO = intNO + 1
Next
Cells(i, "S") = intNO
intNO = intNO + 1
intCount = 0
PrevTaskID = Cells(i, "J")
End If
End If
Next
End Sub
Thanks a ton in advance