Excel Macro Required

AstroMaz

New Member
Joined
Jan 17, 2014
Messages
8
May Peace be on everyone here !

I have a big sales sheet which has columns like date, items, amount and customer name, etc. Now what I want is following:

1. filter a specific customer,
2. copy visible data related to that customer
3. paste in a new sheet
4. name that sheet with the name of customer.

Therefore if there are 25 customers, then there will be 25 sheets with their respective customer names.

Please help me in doing that with macro, or anything !

Thanks !
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
anyone please?

I found this code but I don't know how to use it,please guide me where I have to make changes?

Sub Foo()
Dim c As Range
Dim rng As Range
Dim LR As Long

LR = Cells(Rows.Count, "R").End(xlUp).Row
Set rng = Range("A1:AJ" & LR)

Range("E1:E" & LR).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("AM1"), Unique:=True

For Each c In Range([AM2], Cells(Rows.Count, "AM").End(xlUp))
With rng
.AutoFilter
.AutoFilter Field:=5, Criteria1:=c.Value
.SpecialCells(xlCellTypeVisible).Copy
Sheets.Add(After:=Sheets(Sheets.Count)).Name = c.Value
ActiveSheet.Paste
End With
Next c

End Sub
 
Upvote 0

Forum statistics

Threads
1,217,476
Messages
6,136,889
Members
450,029
Latest member
MissQuotation

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