Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Error Trap Not Working

Excel 2002, WinXP
I have List1 on one sheet, List2 on another sheet, and a third sheet
selected. Many items in List1 are not in List2.
I have the following code with a simple error trap that is not working.
I am getting an "Object variable not set..." error on the
FoundCell.......Find line. I am not seeing how that error could not be
trapped. What am I not seeing?
Thanks for your help. Otto
For Each i In List1
On Error GoTo Nexti
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
Nexti:
On Error GoTo 0
Next i


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Error Trap Not Working

Otto Moehrbach wrote:
Excel 2002, WinXP
I have List1 on one sheet, List2 on another sheet, and a third sheet
selected. Many items in List1 are not in List2.
I have the following code with a simple error trap that is not
working. I am getting an "Object variable not set..." error on the
FoundCell.......Find line. I am not seeing how that error could not
be trapped. What am I not seeing?
Thanks for your help. Otto
For Each i In List1
On Error GoTo Nexti
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
Nexti:
On Error GoTo 0
Next i


If FoundCell is a Range object you should use

Set FoundCell = List2.Find(....)

--
Regards,

Juan Pablo González


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Error Trap Not Working

Hi
try
For Each i In List1
On Error resume next
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
On Error GoTo 0
Next i

--
Regards
Frank Kabel
Frankfurt, Germany


Otto Moehrbach wrote:
Excel 2002, WinXP
I have List1 on one sheet, List2 on another sheet, and a third sheet
selected. Many items in List1 are not in List2.
I have the following code with a simple error trap that is not
working. I am getting an "Object variable not set..." error on the
FoundCell.......Find line. I am not seeing how that error could not
be trapped. What am I not seeing?
Thanks for your help. Otto
For Each i In List1
On Error GoTo Nexti
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
Nexti:
On Error GoTo 0
Next i

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Error Trap Not Working

Sligfht amendement

For Each i In List1
On Error resume next
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
On Error GoTo 0
If Not FoundCell Is Nothing Then
'Copy/Paste FoundCell & stuff
Else
'Do something else
End If Next i


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi
try
For Each i In List1
On Error resume next
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
On Error GoTo 0
Next i

--
Regards
Frank Kabel
Frankfurt, Germany


Otto Moehrbach wrote:
Excel 2002, WinXP
I have List1 on one sheet, List2 on another sheet, and a third sheet
selected. Many items in List1 are not in List2.
I have the following code with a simple error trap that is not
working. I am getting an "Object variable not set..." error on the
FoundCell.......Find line. I am not seeing how that error could not
be trapped. What am I not seeing?
Thanks for your help. Otto
For Each i In List1
On Error GoTo Nexti
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
Nexti:
On Error GoTo 0
Next i



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Error Trap Not Working

Plus of course the Set Foundcell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bob Phillips" wrote in message
...
Sligfht amendement

For Each i In List1
On Error resume next
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
On Error GoTo 0
If Not FoundCell Is Nothing Then
'Copy/Paste FoundCell & stuff
Else
'Do something else
End If Next i


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi
try
For Each i In List1
On Error resume next
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
On Error GoTo 0
Next i

--
Regards
Frank Kabel
Frankfurt, Germany


Otto Moehrbach wrote:
Excel 2002, WinXP
I have List1 on one sheet, List2 on another sheet, and a third sheet
selected. Many items in List1 are not in List2.
I have the following code with a simple error trap that is not
working. I am getting an "Object variable not set..." error on the
FoundCell.......Find line. I am not seeing how that error could not
be trapped. What am I not seeing?
Thanks for your help. Otto
For Each i In List1
On Error GoTo Nexti
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
Nexti:
On Error GoTo 0
Next i







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Error Trap Not Working

Juan
You hit it on the head. I wonder how many times I have made that error.
Muy gracias. Otto
"Juan Pablo González" wrote in message
...
Otto Moehrbach wrote:
Excel 2002, WinXP
I have List1 on one sheet, List2 on another sheet, and a third sheet
selected. Many items in List1 are not in List2.
I have the following code with a simple error trap that is not
working. I am getting an "Object variable not set..." error on the
FoundCell.......Find line. I am not seeing how that error could not
be trapped. What am I not seeing?
Thanks for your help. Otto
For Each i In List1
On Error GoTo Nexti
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
Nexti:
On Error GoTo 0
Next i


If FoundCell is a Range object you should use

Set FoundCell = List2.Find(....)

--
Regards,

Juan Pablo González




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Error Trap Not Working

Frank & Bob
Thanks for your help. I didn't include the variable declarations in my
post so, of course, you didn't know that FoundCell was a range. My error
was that I did not set FoundCell. Thanks for your help. Otto
"Otto Moehrbach" wrote in message
...
Excel 2002, WinXP
I have List1 on one sheet, List2 on another sheet, and a third sheet
selected. Many items in List1 are not in List2.
I have the following code with a simple error trap that is not

working.
I am getting an "Object variable not set..." error on the
FoundCell.......Find line. I am not seeing how that error could not be
trapped. What am I not seeing?
Thanks for your help. Otto
For Each i In List1
On Error GoTo Nexti
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
Nexti:
On Error GoTo 0
Next i




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Error Trap Not Working

Bob
My code didn't work even after I changed "FoundCell=" to "Set
FoundCell=". Your code, however, worked just fine. I still don't
understand why my error trap didn't trap the error. Thanks for your help.
Otto
"Bob Phillips" wrote in message
...
Plus of course the Set Foundcell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bob Phillips" wrote in message
...
Sligfht amendement

For Each i In List1
On Error resume next
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
On Error GoTo 0
If Not FoundCell Is Nothing Then
'Copy/Paste FoundCell & stuff
Else
'Do something else
End If Next i


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi
try
For Each i In List1
On Error resume next
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
On Error GoTo 0
Next i

--
Regards
Frank Kabel
Frankfurt, Germany


Otto Moehrbach wrote:
Excel 2002, WinXP
I have List1 on one sheet, List2 on another sheet, and a third sheet
selected. Many items in List1 are not in List2.
I have the following code with a simple error trap that is not
working. I am getting an "Object variable not set..." error on the
FoundCell.......Find line. I am not seeing how that error could not
be trapped. What am I not seeing?
Thanks for your help. Otto
For Each i In List1
On Error GoTo Nexti
FoundCell = List2.Find(What:=i, LookAt:=xlWhole)
'Copy/Paste FoundCell & stuff
Nexti:
On Error GoTo 0
Next i







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error.Type or IsError to trap #VALUE! and #NUM! Ms. AEB Excel Worksheet Functions 1 July 19th 07 06:51 PM
File Name Exists Error Trap Mike Excel Programming 2 February 21st 04 01:30 AM
Trap a DateValue Error Otto Moehrbach[_6_] Excel Programming 2 February 12th 04 04:51 PM
error trap Rhonda[_3_] Excel Programming 2 October 22nd 03 07:07 PM


All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"