View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach Otto Moehrbach is offline
external usenet poster
 
Posts: 1,090
Default Conditional Copy Macro Help Needed

The following macro might work for you.
I assume that a sheet exists for every name that is in Column A, starting
with A2. An error will result if this is not the case. HTH Otto
Sub CopyData()
Dim RngColA As Range
Dim i As Range
Application.ScreenUpdating = False
Set RngColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
For Each i In RngColA
With Sheets(i.Value)
Range(Cells(i.Row, 2), Cells(i.Row, 10)).Copy
.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial
End With
Next i
Application.ScreenUpdating = True
End Sub
wrote in message
ups.com...
I need a macro that copies rows only if certain text is in column A

For example if Cell "A5" is Evan Jones, then Cells B5-J5 will get
copied to the sheet named "Evan Jones", and if another cell in column A
also says Evan Jones then the same applies for its row except it will
be put in the next row of "Evan Jones" sheet.
I have several names that this will be working with in "Column A" which
is titled "Customer Name", and each line will have information in
columns B-J for those rows....
I hope you understand what I mean, and I hope someone can help....

Thanks