AirMaximus88
New Member
- Joined
- Mar 13, 2014
- Messages
- 16
Hi guys,
Another problem from me, but this time it's VBA based. I'm trying to find data from my clipboard in another spreadsheet. At the moment it's a laborious process of copying, changing windows, findings, etc.
This is the code I'm trying out, but i dont understand why it's producing an error [Runtime error 91: Object vairable or With block variable not set].
Sub FindInP7()
Dim MyData As DataObject
Dim strClip As String
Set MyData = New DataObject
MyData.GetFromClipboard
strClip = MyData.GetText
Windows("P7 Data.xlsx").Activate
Cells.Find(What:=strClip, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
End Sub
I also tried to change ActiveCell to a range of cells, but that didnt work [After:=Range("A1:D1"). If anyone could help me with that and also deciphering what error my noob-like coding has produced, I would appreciate it!
Max
Another problem from me, but this time it's VBA based. I'm trying to find data from my clipboard in another spreadsheet. At the moment it's a laborious process of copying, changing windows, findings, etc.
This is the code I'm trying out, but i dont understand why it's producing an error [Runtime error 91: Object vairable or With block variable not set].
Sub FindInP7()
Dim MyData As DataObject
Dim strClip As String
Set MyData = New DataObject
MyData.GetFromClipboard
strClip = MyData.GetText
Windows("P7 Data.xlsx").Activate
Cells.Find(What:=strClip, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
End Sub
I also tried to change ActiveCell to a range of cells, but that didnt work [After:=Range("A1:D1"). If anyone could help me with that and also deciphering what error my noob-like coding has produced, I would appreciate it!
Max