Hello all, and thank you in advance for spending any time at all on this, likely, very simple oversight on my part.
I am getting the object required error during a simple copy and paste. Odd thing, the object it cannot find is highlighted and ready to be copied.
You may notice some object definition redundancies from trying a few different ways of navigating the perceived problem.
Any assistance or feedback would be greatly appreciated.
I am getting the object required error during a simple copy and paste. Odd thing, the object it cannot find is highlighted and ready to be copied.
You may notice some object definition redundancies from trying a few different ways of navigating the perceived problem.
Any assistance or feedback would be greatly appreciated.
VBA Code:
Dim sampidwrklst As Range
Set sampidwrklst = Sheets("AST Worklist").Range("C4:C2000")
Dim i As Long
For i = 1996 To 1 Step -1
worklist = sampidwrklst.Cells(i).Value
'casewrklst = sampidwrklst.Cells(i).Offset(0, -1)
If worklist = "" Then
ElseIf worklist <> "" Then
Dim sampidorders As Range
Set sampidorders = Sheets("Orders").Range("A2:A400")
Dim j As Long
For j = 399 To 1 Step -1
orders = sampidorders.Cells(j).Value
'caseorders = sampidorders.Cells(j).Offset(0, 1)
If orders = "" Then
ElseIf InStr(1, orders, worklist) > 0 Then
Sheets("Orders").Activate 'the sheet activation was an attempt to be VERY specific in the code as I thought the sheets not activating may be the issue...seems not
orders.Offset(0, 1).Select 'this is the error location in the code, but this cell is found and highlighted at the time of error -- odd
Selection.Copy
Sheets("AST Worklist").Activate
worklist.Offset(0, -1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Else
End If
Next j
Else
End If
Next i
End Sub