I am encountering a runtime 424 Object required error error with the following code and tearing my hair out. Any help in identifying the possible reason for the error would be much appreciated.
Purpose: The code takes data from a particular cell, checks whether its 'AAA' or 'BBB' or not and if it is taking the next cell and concatenating __1111 to it. The concatenated value is then posted in a separate cell
Dataset (last two columns are used)
NV B AEX AAA 123
NV B AEX AAA 456
XO B CAXE BBB 312
XO B CAXE CCC 334
BL B EDXE DDD 555
Sub otc()
MsgBox "Please make sure mapping is updated"
Dim rowcount, colcount1, colcount2, filledrowcount As Integer
Dim cprid, riskname, riskid As String
Dim lookuprange, lookuprange2 As Range
rowcount = 2
colcount1 = 5
colcount2 = 6
filledrowcount = Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row + 1
Do Until rowcount - filledrowcount = 0
Worksheets("Sheet1").Activate
If Activesheet.Cells(rowcount.colcount1) = "AAA" Or Activesheet.Cells(rowcount.colcount1) = "BBB" Then
cprid = Activesheet.Cells(rowcount.colcount2) & "__1111"
Activesheet.Cells(rowcount.colcount1 + 40) = cprid
End If
rowcount = rowcount + 1
Loop
End Sub
Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
Bookmarks