View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Macro To Sort and Seperate Data on Serpate sheets from a Maste

OK

Add one dim line


Dim FieldNum2 As Integer



I use column D in my example to add the word"no" in every row that you copy
Change FieldNum2 to your column

FieldNum = 1
FieldNum2 = 4


Add one filter line

'Filter the range
rng.AutoFilter Field:=FieldNum, Criteria1:="=" & cell.Value
rng.AutoFilter Field:=FieldNum2, Criteria1:="<no"


Replace

With Sheets(rng.Parent.Name)
.Range(.Cells(rng.Cells(1).Row + 1, 1), .Cells(.Rows.Count, 1)).EntireRow.ClearContents
End With


with

With Sheets(rng.Parent.Name)
.Range(.Cells(rng.Cells(1).Row + 1, FieldNum2), .Cells(LastRow(Sheets(rng.Parent.Name)), FieldNum2)).Value = "no"
End With



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Ron de Bruin" wrote in message ...
yes please. You've been a great help today. I apperciate it.


This was your answer when I ask

You can delete the lines you have copy in the same macro

Do you want that ?





I will post another macro this evening that will do what you want


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Troy" wrote in message ...
That cleared the data from the source sheet. And I don't want that to
happen. that data needs to stay. All I want to do is not recopy the same
information on the sub sheets everytime the macro runs.

"Ron de Bruin" wrote:

After the line

Next Cell

Add this

With Sheets(rng.Parent.Name)
.Range(.Cells(rng.Cells(1).Row + 1, 1), .Cells(.Rows.Count, 1)).EntireRow.ClearContents
End With


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Troy" wrote in message ...
yes please. You've been a great help today. I apperciate it.

thanks

"Ron de Bruin" wrote:

You can delete the lines you have copy in the same macro

Do you want that ?



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Troy" wrote in message ...
Thanks for the help. It's working!

However, it copies the previous data everytime the macro runs. Is there
anyway to make it were it only updates new data from the source sheet?

"Ron de Bruin" wrote:

This macro will do what you want
http://www.rondebruin.nl/copy5.htm#below

Be sure you filter on the machine number column and the sheet names have the same name as
the values in this column

Test it in a new workbook
Copy a part of your table in a new workbook and run the code


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Troy" wrote in message ...
I think i worded my question wrong. I do not want to create a new sheet.
the sheets that the data is sperated on would already be created.

So I woud have one source sheet with all machines on it. machine A, machine
b, etc. Everytime a machine breaks, the user will fill out a row of data
starting with the machine name. (example: "machine A"). These rows of data
will be filled out at random.

Then in the same workbook there would be several sub sheets, one for each
machine.

I want to hit a comand button on "Machine A's" sub sheets to run a query on
the source sheet to return all of the row entries that are listed as "Machine
A"

I'm new to programming so that's probably why I don't understand the link
you sent.


"Ron de Bruin" wrote:

Hi Troy

See
http://www.rondebruin.nl/copy5.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Troy" wrote in message ...
I'm using excel 2003.

I have a worksheet full of maintenance data. Each row on this sheet has a
machine number, date, repair information, etc.

I'm trying to make a marco to search thur the list for a specific machine
number copy all the data from that row and paste it on a different sheet.
All of the entries for that machine number would then be copied to that new
sheet.


Does anyone know how to do this?