LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Trapping errors.

Hello,

I have written the below code fragment in Excel Vba. It copies information
from several data sheets to an output sheet if the data sheetname is
contained within a "map" and has been flagged with a "Y".
This works fine if all the sheetnames are contained within the "map". I
noticed however that vlookup falls over if I add new data sheets and don't
remember to update the map at the same time.
Could someone advise as to how to trap the error?

For Each wks In ActiveWorkbook.Sheets
If Application.VLookup(wks.Name, Range("Map!b2:c200"), 2,
False) = "Y" Then
Sheets("Output").Range("A:A").Offset(0, x + 1) =
wks.Range("J:J").Value
x = x + 1
End If
Next wks


 
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
Trapping errors in a VLOOKUP function Blue Max Excel Worksheet Functions 1 April 26th 09 03:03 AM
Trapping errors with Conditional Formatting Sandusky Excel Discussion (Misc queries) 3 January 6th 09 08:52 PM
Trapping errors ssemtaf Excel Programming 2 October 27th 08 07:56 PM
GetOpenFilename - Trapping Errors Tim Childs Excel Programming 5 April 9th 06 03:58 PM
annoying bell when trapping errors Mika Excel Programming 0 November 7th 03 10:41 AM


All times are GMT +1. The time now is 09:22 PM.

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

About Us

"It's about Microsoft Excel"