When I execute this code, I get this error: Runtime Error 438, Object doesn't support this property or method
Sub LastRowInOneColumn()
'Find the last used row in a Column: column A in this example
Sheets("Sheet1").Select
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Cells(LastRow, 1).Select
Dim MyData As DataObject
Dim TMCNumber As String
TMCNumber = ActiveCell.Value
Set MyData = New DataObject
MyData.SetText TMCNumber
MyData.PutInClipboard
MyData.GetFromClipboard
Sheets("Sheet2").Select
Cells.Find(What:=MyData, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
End Sub
Basically, what I'm trying to do is grab the value of the first cell of the last row in Sheet1, then find the cell with that value in Sheet2. I put a breakpoint in "MyData.GetFromClipboard" and the code seems to crash in the Cells.Find block. I copied that block from a macro I recorded where I manually opened the Find function and looked for a value, then just replaced the value in the macro with the name of the DataObject variable.
Bookmarks