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: 31
Default using activeworkbook.worksheets

I have been looking for the correct way to use the following

For Each wsheet In ActiveWorkbook.Sheet(Sheet280, Sheet283,
Sheet284, Sheet285, Sheet286, Sheet287, Sheet288)

how can i use activeworkbook.worksheets and specify certain sheets in
the workbook.

the way i am using it is not giving errors but is not returning
anything. here is the full code :

Function vlookallsheets(Look_Value As Variant, Tble_Array As Range, _
Col_num As Integer, Optional Range_look As
Boolean)

'Use VLOOKUP to Look across ALL Worksheets and stops _
at the first match found.
'''''''''''''''''''''''''''''''''''''''''''''''''
Application.ScreenUpdating = False

Dim wSheet As Worksheet
Dim vFound

On Error Resume Next

For Each wSheet In ActiveWorkbook.Worksheet(Sheet280, Sheet283,
Sheet284, Sheet285, Sheet286, Sheet287, Sheet288)
With wSheet
Set Tble_Array = .Range(Tble_Array.Address)
vFound = WorksheetFunction.VLookup _
(Look_Value, Tble_Array, _
Col_num, Range_look)
End With
If Not IsEmpty(vFound) Then Exit For
Next wSheet

Set Tble_Array = Nothing
vlookallsheets = vFound
Application.ScreenUpdating = True

End Function

Thnx

 
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
How do i assign the ActiveWorkbook.Worksheets to a worksheets object? TS Excel Worksheet Functions 2 December 27th 06 02:49 PM
How do i assign the ActiveWorkbook.Worksheets to a worksheets object? TS Excel Programming 0 December 27th 06 02:49 PM
Adding a sheets name to the worksheets that are copied over from an addin file to the activeworkbook KimberlyC Excel Programming 2 May 7th 05 04:10 AM
For Each wks In ActiveWorkbook.Worksheets bar a specific one? Pank Mehta Excel Discussion (Misc queries) 4 March 30th 05 04:53 PM
Populating a listbox will a certain cell on multiple worksheets in the activeworkbook KimberlyC Excel Programming 2 March 16th 05 12:49 AM


All times are GMT +1. The time now is 06:49 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"