If Cell C3 (Sheet2) is equal to any value in Column A (Sheet1) then Copy Matched row from Sheet 1

Realjoshtodd

New Member
Joined
Sep 26, 2017
Messages
34
I'm needing some help with creating a VBA code for the following:

If a Name is entered into Cell C3 on Sheet2 in Workbook and it matches any of the Names in Column A on Sheet1. Then I want to copy the entire row of data in sheet1 to Row1 in Sheet2.
 
Howard you saved the day.

I have one more (that I know of at this point) code that I'm trying to get working.

I'm entering 5 Dates into 5 cells (B1:B5) on "Daily Alignment" sheet.

I want the the code to find the matching dates on "Availability" sheet. I need to copy all of the data in that column (that has a value entered into it) that matches any of the dates, as well as the Copy the same cell in column B.

Ultimately I would like it to sort all of the values of Column B by the values in the Date matching column. (Days, Swings 1, Swings 2, Lates, Control, Other (Anything that has a value that doesn't match the others).

Using the codes before I've able to get it to copy the columns but cant get it to limit to only ones with values, and can't get it to sort.

Any help would be greatly appreciated.

Josh
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
How about posting a link to your workbook (or an example workbook). You can use one of the link utilities like Drop Box and others to do that. You cannot attach a workbook here.

In that post, restate what you want to happen and where or what is not working.

Howard
 
Upvote 0
On the Daily Alignment Tab, in the B1, C1, D1, E1 Cells, I want to be able to enter a Date.

I want to be able to click a Import Button that will copy over from the Deputy Availability tab all of the people that are working on those same dates according. (Names are in the B Column, their working status for each day is in the other columns.

When it copies them over I need it to sort them automatically in the following order (Days, E Swings, L Swings, Lates, D CTRL, D CTRL 1, D CTRL 2, N CTRL, N CTRL 1, N CTRL 2, and then any other value that is listed.)

That's the basic that I need it to do.

I've been messing with the other code you have given me to try to get it to pull both columns but haven't had any luck making it work smoothly.
 
Last edited:
Upvote 0
I have the workbook, and I am unable to get a code to work to find the date from one sheet on another and return the names of those on duty in the column below it.

I suggest you make a new post with this code request, where someone more adept working with dates can help you.

Sorry I could not get it done for you.

Howard
 
Upvote 0
Would it be any different if it was based on matching value (in place of the date) I can change the date format to anything.

I almost fill like it should be a If B1(sheet1) = value in any Row 2 on sheet 2 then copy all cells with a value to Sheet 1 Column G (That would show the on duty status). Then have it copy all values from Sheet 2 Column B where there is a value from in the previous matching.

I can see it in my head but can't figure how to make it work in a code.
 
Upvote 0
I'll relook the workbook and perhaps draw on some other resources to see if I can make it work

Just to be clear, say the date 1/19/2018 is in cell B1 on sheet Daily Alignment.

Then under that date the names Hettinger, Vaughn, Billington, Runge would appear. These names are from BOOKING and are considered "on duty" because there is a "job" assigned from the drop downs for all those names. Hinkle has no "job" so that name is omitted.

And all the same for all the other categories, COMMAND, BLUE DAYS etc. Looks like there would be 50, 100, 180 names some times.

Is that the way it is supposed to work for all the B1, C1, D1, E1 cells on sheet Daily Alignment? Also on these cells, will you always have five dates (one in each cell) when you 'click the button'? Or maybe just a single date, or maybe two?

Again, with the B1:E1 cells, do you want a button for sure or do you want to enter a date in any cell and have the names appear upon hitting ENTER after typing the date in? So if you entered a date in C1 and hit ENTER, the names for that date appear under C1. Then you go to E1 and enter a date > ENTER and the names appear under E1.

I have some concerns about the Daily Availability sheet rows 3 thru 31 being hidden. Not sure if that will be a problem.

Howard
 
Upvote 0
I do need it to be a button. But thats easy to assign.

I would like it to show the name and the work duty next to their name.
 
Upvote 0
I do need it to be a button

The reason I ask about a button is... how is the code to know which of the B1, C1, D1, E1 cells to respond to? That is, when you click the button there needs to be a method for the code to know which of the cells to take the date from and do its processing.

I would like it to show the name and the work duty next to their name.

So, if say, D1 is the cell/column then the name (from sheet Deputy Availability column B ) and the drop down duty selection (from the matching date column) would BOTH appear in the cells below D1 on sheet Daily Alignment?

Howard
 
Upvote 0
Ok so I see what you mean with the button. Enter will work in that case to make it easier.

I would want it to pull all of duties for that date and list side by side the name and the duty. We could have to side by side in columns. I know we would have to push the columns one more apart in that case.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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