Hi,
I have a worksheet full of data for which I would like to create serial numbers, given certain critria are met.
I'm using the "While" function to loop through rows, for as long as they have some text. Then I'm utilizing an "If Statement" to see if 3 criteria are met.
if so, I would like VBA to create a serial number by concatenating specific fields and text; otherwise just carry on with next row.
I get an error message "Object Required" but have no idea what it refers to
I have a worksheet full of data for which I would like to create serial numbers, given certain critria are met.
I'm using the "While" function to loop through rows, for as long as they have some text. Then I'm utilizing an "If Statement" to see if 3 criteria are met.
if so, I would like VBA to create a serial number by concatenating specific fields and text; otherwise just carry on with next row.
I get an error message "Object Required" but have no idea what it refers to
Code:
Sub SerialNumber()
Dim Statement As Worksheet
Dim i As Long
' i = row number
i = 3
Set Statement = Activebook.Sheets("Statement")
While WorksheetFunction.IsText(Sheets("Statement").Cells(i, 1)) = True
With Statement
If (Range(i, 1) = "T" And Range(i, 90) = "E" And Range(i, 91) = "E") Then
.Cells(i, 92).Value = WorksheetFunction.CONCATENATE(Range(i, 74), "N", Range(i, 20))
Else:
End If
End With
i = i + 1
Wend
End Sub