sebastriantran
New Member
- Joined
- Sep 19, 2014
- Messages
- 31
Hi everyone,
My company is purchasing thousands of item via Paypal and I am building a macro to get data from checkout page. Normally I want to get the Funding type and Funding sources. So here is what I do:
1) Copy whole content of the checkout page (Ctrl C)
2) Paste all content into my worksheet (Ctrl V)
3) In VBA, I use Find to searh the word:
However it seems that my error handling does not work. What I want is to make the macro run through each case of funding: Bank account, Credit card, Voucher, Paypal balance. But when there's only Voucher, it shows run-time error '91 with lines on Credit card.
Any suggestion to my case?
Thank you very much!
My company is purchasing thousands of item via Paypal and I am building a macro to get data from checkout page. Normally I want to get the Funding type and Funding sources. So here is what I do:
1) Copy whole content of the checkout page (Ctrl C)
2) Paste all content into my worksheet (Ctrl V)
3) In VBA, I use Find to searh the word:
Code:
'Locate bank
On Error GoTo Creditcard
Selection.Find(What:="Funding type: Bank Account", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Copy Range("Q" & k)
Selection.Find(What:="Funding type: Bank Account", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(1, 0).Copy Range("R" & k)
'Locate card
Creditcard:
On Error GoTo Voucher
Selection.Find(What:="Funding type: Credit Card", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Copy Range("Q" & k)
Selection.Find(What:="Funding type: Credit Card", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(1, 0).Copy Range("R" & k)
'Locate voucher
Voucher:
Selection.Find(What:="Funding type: Voucher", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Copy Range("S" & k)
Selection.Find(What:="Funding type: Voucher", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(1, 0).Copy Range("T" & k)
However it seems that my error handling does not work. What I want is to make the macro run through each case of funding: Bank account, Credit card, Voucher, Paypal balance. But when there's only Voucher, it shows run-time error '91 with lines on Credit card.
Any suggestion to my case?
Thank you very much!
Last edited: