IMPORTANT:
You need to add the Microsoft Forms 2.0 library to be able to get data off the clipboard in VBA. Instructions on how to do that are here, including what to do in Forms 2.0 isn't listed in the references. Once you add that, you should be fine.
Sub ninjabear()
On Error GoTo ErrExplain
Set DataObj = New MSForms.DataObject
DataObj.GetFromClipboard
Tracking = DataObj.GetText(1)
Range("B2").Value = Left(Tracking, 3)
Range("C2").Value = Mid(Tracking, 4, 3)
Range("A23").Value = Mid(Tracking, 7, 7)
Range("B23").Value = Right(Tracking, 3)
ErrExplain:
If Err <> 0 Then MsgBox ("clipboard is empty or does not contain text")
End Sub
Bookmarks