View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Loop through sheets & filter main sheet using sheet name

Not sure where you want to paste the data. I wrote the data to the entire
sheet.

Sub FilterDate()


For Each sht In ThisWorkbook.Sheets
If sht.Name < "Hauptseite-1" Then
With Sheets("Hauptseite-1")
If .FilterMode = True Then
.ShowAllData
End If
Columns("O").AutoFilter field:=1, Criteria1:=sht.Name
.Cells.SpecialCells(xlCellTypeVisible).Copy _
Destination:=sht.Cells
End With
End If
Next sht
If Sheets("Hauptseite-1").FilterMode = True Then
Sheets("Hauptseite-1").ShowAllData
End If
End Sub

"Les" wrote:

Hello all, as i am not a programmer i am battling with the following...
I have a wkb with the main sheet "Hauptseite-1" in this sheet i have a
variable amount of rows with the names of the responsible person in column
"O". I have created a sheet for each name & the sheet is named with the
applicable name.
I now need to loop through all sheets, with the exception of "Hauptseite-1"
and filter column "O" on the sheet "Hauptseite-1" using the sheet Names as
the filter criteria, copy the data found and past it onto the respective
sheet.

I would be very gratefull for any help.
--
Les