Moving Data to a Different Worksheet

lgerjets

New Member
Joined
Dec 4, 2009
Messages
18
I am trying to move rows of data from worksheet 1 to other worksheets based on what name is listed in column B.

Example:
If row 1 had "Bohlmann" in column B, the entire row would go to the "Bohlmann" worksheet
If row 2 had "Madsen" in column B, the entire row would go to the "Madsen" worksheet

I am looking to keep my worksheet 1 with all of the data as is, but sort out the information by column B to different worksheet. Any ideas?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
A few questions
1) Do all the other sheets exist?
2) Do you have a header row in row 1 with data starting in row 2?
3) do you want to clear the existing sheets, or add new data at the bottom?
 
Upvote 0
See below in RED

a few questions
1) do all the other sheets exist? yes
2) do you have a header row in row 1 with data starting in row 2? yes
3) do you want to clear the existing sheets, or add new data at the bottom? add to bottom
 
Upvote 0
try this
Code:
Sub FilterCopy()

   Dim Cl As Range
   Dim Ws As Worksheet
   
   Set Ws = Sheets("[COLOR=#ff0000]sheet1[/COLOR]")
   If Ws.AutoFilterMode Then Ws.AutoFilterMode = False
   With CreateObject("scripting.dictionary")
      For Each Cl In Ws.Range("B2", Ws.Range("B" & Rows.Count).End(xlUp))
         If Not .exists(Cl.Value) Then
            .Add Cl.Value, Nothing
            Ws.Range("A1").AutoFilter 2, Cl.Value
            Ws.UsedRange.Offset(1).SpecialCells(xlVisible).Copy Sheets(Cl.Value).Range("A" & Rows.Count).End(xlUp).Offset(1)
         End If
      Next Cl
   End With
   Ws.AutoFilterMode = False
End Sub
Change the sheet name in red to suit
 
Upvote 0
Thanks, I'll give that a try!

try this
Code:
Sub FilterCopy()

   Dim Cl As Range
   Dim Ws As Worksheet
   
   Set Ws = Sheets("[COLOR=#ff0000]sheet1[/COLOR]")
   If Ws.AutoFilterMode Then Ws.AutoFilterMode = False
   With CreateObject("scripting.dictionary")
      For Each Cl In Ws.Range("B2", Ws.Range("B" & Rows.Count).End(xlUp))
         If Not .exists(Cl.Value) Then
            .Add Cl.Value, Nothing
            Ws.Range("A1").AutoFilter 2, Cl.Value
            Ws.UsedRange.Offset(1).SpecialCells(xlVisible).Copy Sheets(Cl.Value).Range("A" & Rows.Count).End(xlUp).Offset(1)
         End If
      Next Cl
   End With
   Ws.AutoFilterMode = False
End Sub
Change the sheet name in red to suit
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,442
Members
449,083
Latest member
Ava19

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