Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Rows To Sheet Based On Cell Value In Range

Status
Not open for further replies.

JoeMicro

Technical User
Aug 24, 2007
76
CA
HI:
Could anybody help me

i need a macro button on my excel sheet that should do the following.

i have a range (Ex: A3:E46) which is being continuously filled, i need to transfer the information to another sheet depending on column "E", (Ex: if "E3" = "A" paste row to sheet2 if = "B" paste row to sheet3) and so on each row could have another string in column "E".

after the paste is done it should clear the range making place for new entries, that should also be copied finding the next empty cell (it shouldn't delete the old entries)

i have got this code already, but it doesn't copy the entire Row, it just copy's information in column "E".

Code:
Sub VCopy() 
    Dim strWs As String
    Dim strPass As String
    Dim rCell As Range

 For Each rCell In Range("E3",Cells(Rows.Count,"E").End(xlUp)) 
         
        Select  Case UCase(rCell) 
        Case "A": strWs = "Sheet1" 
        Case "B": strWs = "Sheet2" 
        Case "C": strWs = "Sheet3" 
             'Follow the pattern' End Select 
         
        rCell.EntireRow.Copy _ 
        Destination:= Sheets(strWs).Cells(Rows.Count, 1).End(xlUp)(2, 1) 
         
    Next rCell 
    Range("E3", Cells(Rows.Count, "E").End(xlUp)).Clear 
End Sub


Thanks in Advanced
 




Please post VBA Code questions in Forum707.

Skip,

[glasses] When a wee mystic is on the loose..
It's a Small Medium at Large! [tongue]
 
How do i transfer this thread over, i don't want to cross post.

Thanks
 



Don't worry about it.

Skip,

[glasses] When a wee mystic is on the loose..
It's a Small Medium at Large! [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top