copy and save data to multiple unique spreadsheets

waterboy202

New Member
Joined
Mar 23, 2007
Messages
38
Hi All

I am new in making marcos and am using Excell 2000. I was wounding if you could help me out. I am trying to make a Marco that will be able to:

-Sort by a certain column lets say X
-Copy all the rows with the same name &/or number in column X to a new spreadsheet, (keeping the header the same)
-save it, name the file to that in column X & the date data in column Y2
-then do it again till there is no more info

For example, if I have master spreadsheet with several different fruits and data about them. I want to separate all of the different info on the respective fruit into multiple spreadsheets and save them. All the apples one spread sheet all of the pears on the other one & all the Apply 1's on another. I would like to be able to save the file with the date located in Y2 along with todays date.

Could some one please help me out?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
type the name of the fruits in A20 and below
see the sample sheet below
run this macro "test"
after running the macro if it is ok you can run the maro "undo" to remove the new sheets and again test the macro

modify the macro to suit you
the macros are

Code:
Sub test()
Dim rng As Range
Dim fruit As Range
With Worksheets("sheet1")
Set rng = Range(.Range("a1"), .Range("a1").End(xlDown))
Set fruit = .Range("a20")
line2:

rng.AutoFilter field:=1, Criteria1:=fruit.Value
Range(.Range("a1"), .Range("a1").End(xlDown).End(xlToRight)).Copy
Worksheets.Add before:=Worksheets(Worksheets.Count)
ActiveSheet.Name = fruit.Value
Range("a1").PasteSpecial
Set fruit = fruit.Offset(1, 0)
If fruit = "" Then GoTo line1
.Range("a1").AutoFilter

GoTo line2:
End With
line1:
Worksheets("sheet1").Range("a1").AutoFilter
MsgBox "macro over"
End Sub
Code:
Sub undo()
On Error GoTo line1
Application.DisplayAlerts = False
Sheets(Array("apple", "banana", "pear")).Delete
line1:
Application.DisplayAlerts = True


End Sub
Book2
ABCD
1fruitdata
2apple1
3pear2
4banana3
5apple4
6apple5
7banana6
8pear7
9banana8
10
11
12
13
14
15
16
17
18
19
20apple
21banana
22pear
Sheet1
 
Upvote 0

Forum statistics

Threads
1,214,635
Messages
6,120,660
Members
448,975
Latest member
sweeberry

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