Thread: Gathering Data
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Gathering Data

You almost got it right:

Sub CopytheRowoftheActiveCell()
With Worksheets("All")
Selection.EntireRow.Copy Destination:= _
.Cells(Rows.Count, 1).End(xlUp)(2)
.Range("A1").CurrentRegion.Sort _
Key1:=.Range("B2"), Header:=xlYes
End With
End Sub

This assumes row 1 on "All" has your headers in it.

--
Regards,
Tom Ogilvy


"Spreadsheet"
wrote in message
...

VB didn't like parts of the code, so I changed it to this:

Sub CopytheRowoftheActiveCell()
With Worksheets("All")
Selection.EntireRow.Copy Destination:=.Cells(Rows.Count,
1).End(xlUp)(2)
Range("A1").CurrentRegion.Sort Key1:=.Range("B2"), _
Header:=xlYes
End With
End Sub


When I ran the macro, it said that the sort reference was not valid.


--
Spreadsheet
------------------------------------------------------------------------
Spreadsheet's Profile:

http://www.excelforum.com/member.php...o&userid=34730
View this thread: http://www.excelforum.com/showthread...hreadid=551134