copying to main sheet

chris1234567

New Member
Joined
Sep 21, 2006
Messages
12
I have a spreadsheet with 8 tabs accross the bottom

the first is called staff
the next six tabs are labelled a,b,c,d,e,f

What I require is when the number is column B on all 6 sheets starts with a T for example: T9777 would fit the criteria it will copy that whole row and place it on the next avaiable row on the first tab "staff".

I need it too look through all the B colums on all six sheets.

Can this be done without invloving VBA
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

venkat1926

Well-known Member
Joined
Aug 21, 2005
Messages
4,824
I assume thet there is no other previous data in sheet staff.

now run the macro given below. see the comments inthe codes.
Code:
Sub TEST()
Worksheets("staff").Cells.Clear
'the above line is to celar the sheet staff so that
'you can test the macro once or twice
'this assumes there is no other data in "staff"

Dim x, add As String
Dim dest, cfind As Range
x = "T"
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
sh.Activate
If sh.Name = "staff" Then GoTo line1
Set cfind = Cells.Find(what:="T")
If Not cfind Is Nothing Then
If cfind.Column <> 2 Then GoTo line2
add = cfind.Address
Set dest = Worksheets("staff").Cells(Rows.Count, "b").End(xlUp).Offset(1, 0)
'MsgBox dest.Address
cfind.EntireRow.Copy dest.Offset(0, -1)
line2:
End If
Do
Set cfind = Cells.FindNext(after:=cfind)
If cfind.Column <> 2 Then GoTo line3
Set dest = Worksheets("staff").Cells(Rows.Count, "b").End(xlUp).Offset(1, 0)
'MsgBox dest.Address

cfind.EntireRow.Copy dest.Offset(0, -1)
line3:
Loop While Not cfind Is Nothing And cfind.Address <> add
line1:
Next sh
Worksheets("staff").Activate
MsgBox "macro is over"
End Sub
 

Forum statistics

Threads
1,141,678
Messages
5,707,782
Members
421,527
Latest member
Tamiwsw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top