Hi all
Window 7 / excel 2010
Here comes my problem, I get workbooks full of data but not organised except for one thing the phone number is in the cell below the cell with the valuue "Phone"
Currently I can retrieve each number in a sheet and create the list on the sheet 6.
here is my code
then i want it to loop through each worksheet and it doesn't work .
I've tried with this
And later i'd like it to loop through all the open workbook.
Note that all workbook have the same format name (1.Guestphonelist to 11.Guestphonelist). All contain 6 worksheets and I want to add everything in the worsheets("Sheet6")
I can't get the loop to work.
If some could help itd be appreciate.
Thx
Window 7 / excel 2010
Here comes my problem, I get workbooks full of data but not organised except for one thing the phone number is in the cell below the cell with the valuue "Phone"
Currently I can retrieve each number in a sheet and create the list on the sheet 6.
here is my code
Code:
Sub RETRIEVE_AND_LIST()
Dim Lrow As Long
Dim Lcol As Long
Dim Lastrow As Long
Dim i As Range
Lrow = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
Lcol = Sheets("sheet1").Cells(1, Columns.Count).End(xlToLeft).Column
For Each i In Range(Cells(1, 1), Cells(Lrow, Lcol))
If i.Value = "phone" Then
Lastrow = Sheets("Sheet6").Cells(Rows.Count, "A").End(xlUp).Row
i.Offset(1, 0).Copy Destination:=Sheets("Sheet6").Range("A" & Lastrow + 1)
End If
Next i
End Sub
End Sub
then i want it to loop through each worksheet and it doesn't work .
I've tried with this
Code:
Sub RETRIEVE_AND_LIST()
Dim Lrow As Long
Dim Lcol As Long
Dim Lastrow As Long
Dim i As Range
Dim w As Worksheet
Lrow = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
Lcol = Sheets("sheet1").Cells(1, Columns.Count).End(xlToLeft).Column
For Each w In Worksheets
For Each i In Range(Cells(1, 1), Cells(Lrow, Lcol))
If i.Value = "phone" Then
Lastrow = Sheets("Sheet6").Cells(Rows.Count, "A").End(xlUp).Row
i.Offset(1, 0).Copy Destination:=Sheets("Sheet6").Range("A" & Lastrow + 1)
End If
Next i
Next w
End Sub
And later i'd like it to loop through all the open workbook.
Note that all workbook have the same format name (1.Guestphonelist to 11.Guestphonelist). All contain 6 worksheets and I want to add everything in the worsheets("Sheet6")
I can't get the loop to work.
If some could help itd be appreciate.
Thx