Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

VB function

  Asked By: Hope    Date: Nov 12    Category: MS Office    Views: 729
  

Looking for help with some code

What i need is it to match a name in a list and search through all
worksheets and return any data that is found with that persons name in
different workbooks


Basicly we are tracking Overtime for everyone one the team with what
department the overtime was spent in, i have worksheets for every month
with all the data in there, and i want a summary basicly

hope i was clear on this

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Stefan Thompson     Answered On: Nov 12

Sounds as thought the key thing is to loop through a set of worksheets.

The following code will do that.

Sub subLoopThroughSheets()
' Loop through a woorkbook.

Dim slSheetName As String
Dim olSheet As Worksheet

For Each olSheet In Worksheets
slSheetName = UCase(olSheet.Name)
olSheet.Activate

Select Case slSheetName

' Do NOT "process" at these sheets.
Case "A", "B", "C"
' Do nothing.

Case Else
' Collect data... maybe put it in an array.

End Select
Next olSheet

' Go to the worksheet you want the summary  in and process the array.

MsgBox "Done."

End Sub

 
Didn't find what you were looking for? Find more on VB function Or get search suggestion and latest updates.




Tagged: