Search a Column for a specific Value and Place in Another sheet

trevor2524

New Member
Joined
Jul 24, 2013
Messages
13
Hello, I need help creating the following part of a macro. I have information that will be on sheet 1 in the following format:
Column A,Column B,Column C,Column D,Column E
File Number,Field Name,Changed From,Changed To, Modified By

I will have up to 14 sheets one for each person making a modification.
So Sheet 2 = John Doe
Sheet 3 = Jane Smith and so on....

On sheet 1 I would Like a Macro to start by searching Column E. For John Doe and if it comes along a John Doe it will then copy that row into the first empty row in column A on the sheet that corresponds with that name. So for John Smith it would be Sheet 2 and for Jane Smith it will copy to the first available row in Column A in Sheet 3. I have another step after this but this portion needs to be done before anything else and I'm just trying to get the basic of the macro started. Thanks for your help.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
This does not follow step by step what you described, but it gives the same result. Give it a try and if there is a problem, post back.
Code:
Sub nomDeName()
Dim sh As Worksheet, lr As Long, rng As Range
lr = Sheets(1).Cells(Rows.Count, 5).End(xlUp).Row
Set rng = Sheets(1).Range("E2:E" & lr)
    For Each c In rng
        If c <> "" Then
            Set sh = Sheets(c.Value)
            c.EntireRow.Copy sh.Cells(Rows.Count, 1).End(xlUp)(2)
        End If
    Next
End Sub
 
Upvote 0
Works Perfect Thank You, Since you know how to do that can you help me with one more portion.I'm trying to come up with a macro that will search Column B for specific fields as well. If the field equals the word Red then it will copy the cells from that column A to column D. It will then place it in Column F starting at cell 20. It will then go back to Column A and check the next row. If it equals Blue it will then copy the first four cells in that row and then paste them in Column K cell 20. If the cell equals Red it will then go back to Column F and go to the next available cell in column F after row 20. The total options I would have about 20 options but right now if we do it with Red, Blue, Yellow, Orange, Gray and I could figure out the rest from there. I appreciate this help if you can. I see its kinda like the previous one you sent me but with a few different options.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,311
Members
449,080
Latest member
jmsotelo

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