Using Xlookup in VBA to locate a cell based on 2 values and drop information into that cell

MedicineVan

New Member
Joined
May 19, 2022
Messages
9
Office Version
  1. 2010
Platform
  1. Windows
Here's what I'm looking to achieve.

I have a sheet where users select the Week Commencing and Department Name, and to then answer a number of questions that relate to that department.
Depending on what department they select will alter the questions that they are asked.

I have this bit nailed - it was fairly straight forward.


The bit I'm stuck on is the next bit.

I'd like to add a button that copies this information(the answers to the questions) and then it opens an existing workbook.
This workbook has in Column A - The name of a department and the 10 or so questions, a blank row, then the name of the next department and their 10 or so questions, etc.
Across Row 1 it has the Dates in Week Commencing 02/05/2022, 09/05/2022, etc. (See below)

What I'd like is for Xlookup to locate the Department select that Row, locate the Week Commencing and select that Column, and to paste the information in here. Albeit dropping down 1 cell as the selected cell will be the Department Name and not the answers to the questions.

So If the user Selects Department 2 and Week Commencing the 09/05/2022 I would like C12 to be selected and for the data in the clipboard to be pasted here.

I'm also very happy with other ideas as to how to achieve this - I'm not stuck on using Xlookup. I achieved something similar about 8 years ago using Vlookup and Index Match, but I'll be damned if I can recall what I did and after several hours of tinkering and forum searching I am still at a loss, hence my question on here.

Thank you to everyone for your effort and energy : )


1652957416081.png
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

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