Coompletely lost trying to extract to different sheets

jdev33

New Member
Joined
Sep 7, 2011
Messages
12
I am looking for advice here. This is the situation. I am working at a company that maintains a large spreadsheet on all the employees - roughly 30 columns for each of the nearly 2000 employees. One column holds a number representing the department within the company that the employee works for. There are 33 different areas within the company and we're trying to find a better way of pulling the information for each department into its own spreadsheet (within the same workbook is fine or into a new workbook if that turns out to be easier). Right now it's a matter of sorting/filtering and then copy/paste to different sheets. I would like to create a formula (or macro if someone understands that better) that will scan through all department numbers and then pull the emtire rows of information to a new spreadsheet. (eg. department numbers are in Column Y, so I want to identify everyone in the department numbered 12345 and then pull the entire row of information for anyone matching that department into a new sheet.

Also, is there a way to compare to spreadsheets (not side-by-side comparison) for differences? They update this "master" sheet all the time and expect people to handy-dandy pull new changes out at the drop of a hat, but there's no way of seeing what's changed without having to do a side-by-side comparison... which is horribly inefficient when you're talking about doing side-by-side to scan every cell on a roughly 35x2000 spreadsheet. Any tips on this would also be greatly appreciated.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I am looking for advice here. This is the situation. I am working at a company that maintains a large spreadsheet on all the employees - roughly 30 columns for each of the nearly 2000 employees. One column holds a number representing the department within the company that the employee works for. There are 33 different areas within the company and we're trying to find a better way of pulling the information for each department into its own spreadsheet (within the same workbook is fine or into a new workbook if that turns out to be easier). Right now it's a matter of sorting/filtering and then copy/paste to different sheets. I would like to create a formula (or macro if someone understands that better) that will scan through all department numbers and then pull the emtire rows of information to a new spreadsheet. (eg. department numbers are in Column Y, so I want to identify everyone in the department numbered 12345 and then pull the entire row of information for anyone matching that department into a new sheet.

Also, is there a way to compare to spreadsheets (not side-by-side comparison) for differences? They update this "master" sheet all the time and expect people to handy-dandy pull new changes out at the drop of a hat, but there's no way of seeing what's changed without having to do a side-by-side comparison... which is horribly inefficient when you're talking about doing side-by-side to scan every cell on a roughly 35x2000 spreadsheet. Any tips on this would also be greatly appreciated.

I would suggest using Access, rather than Excel...especially with large amounts of data.
 
Upvote 0
Try this...

Code:
Sub Copy_Paste_By_Dept()
Dim i As Long
Dim LR As Long
Dim NR As Long
Dim ws As Worksheet
    
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Specific Department"
Set ws = Sheets("Specific Department")

Sheets(1).Select
LR = Range("Y" & Rows.Count).End(xlUp).Row
NR = 2
    Range("A1").EntireRow.Copy Destination:=ws.Range("A1")

For i = 2 To LR
    If Range("Y" & i) = 12345 Then
        Range("A" & i).EntireRow.Copy Destination:=ws.Range("A" & NR)
        NR = NR + 1
    End If
Next i

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,259
Members
452,901
Latest member
LisaGo

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
Back
Top