Noob looking for VBA help, please

Gaffee

New Member
Joined
Jul 8, 2022
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hi Guys, please be kind as this is my first time posting.

I have limited experience with VBA and can do some basic stuff but what I'm trying to accomplish I cannot figure out in my head. I'm using Excel 2016.

I want to select a name from a drop down list. This will then search column 2 on a different sheet for said name, then copy specific columns (2-5, 7-13) of the matching row to a specific row on the same sheet as the drop down list. I want to run this code by pressing a command button.
The columns that get copied are always the same, as is the destination.

Any help would be greatly recieved, and if you can explain it would be great so I can learn for future.

If you need any other info I'll gladly provide it.

Thanks
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Would you not be better to use an index and match in each cell on the same sheet to return the values that match the item selected in the dropdown for the various columns

So a formula of =IFERROR(INDEX(Rawdata[item1],MATCH([@Dropdown],Rawdata[Name],0)),"") will return Item 1 of the raw data that you are looking into that matches the item selected in the dropdown.
Hope that makes sense
 
Upvote 0
Hello Gaffee,

Based on your description, we'd have to make numerous assumptions as to your data set out which would lead to many unnecessary posts. Please upload a sample of your workbook using this forum's mini sheet function (XL2BB) or via a file sharing site such as WeTransfer or Drop Box. If your data is sensitive, then please use dummy data. Please ensure that the sample is an exact replica of your actual workbook in all aspects and show inputs and expected results.

Cheerio,
vcoolio.
 
Upvote 0
Hello Gaffee,

Based on your description, we'd have to make numerous assumptions as to your data set out which would lead to many unnecessary posts. Please upload a sample of your workbook using this forum's mini sheet function (XL2BB) or via a file sharing site such as WeTransfer or Drop Box. If your data is sensitive, then please use dummy data. Please ensure that the sample is an exact replica of your actual workbook in all aspects and show inputs and expected results.

Cheerio,
vcoolio.
I've included the mini sheet.

Basically I have the exact same table on another sheet, I just want to use the drop down list to select a name, which then puts only their information on this sheet below the headers. The dropdown list will have a list of names which will match column B on the other sheet, and if there is a match I want it to copy the other columns from that row.

Does that make any sense?

Cheers
Gaffee

Leave Planner Integration 2023.xlsm
ABCDEFGHIJKLMNOPQRSTUV
2
3
201Annual LeaveSick Leave
21ID(Hidden)First NameLast NameDepartmentEnhanced EntitlementContractual EntitlementEnhanced Carry OverContractual Carry overAnnual Leave - Total Entitlement CalculatedAnnual Leave - TakenAnnual Leave - RemainingTaken as LeaveUnpaidMaternity/Paternity Leave TakenCompassionate Leave TakenUnpaid Leave Taken
221Joe BloggsJoeBloggsAcme203023
Reports
Cell Formulas
RangeFormula
B22B22=(C22&" "&D22)
Cells with Data Validation
CellAllowCriteria
A2:D3List=OFFSET($AZ$22,0,0,COUNTA($AZ:$AZ)-1,1)
 
Upvote 0
Hello Gaffee,

There is still more that we need to know:-
- Your sample appears to be the destination sheet ("Report") in which you have the drop down list. What is the name of the source sheet?
- Your headings are a long way down the sheet. Are they actually in row21 on both sheets?
- In which cell of the destination sheet ("Report") is the drop down?

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,215,779
Messages
6,126,842
Members
449,343
Latest member
DEWS2031

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