Drop down
Closedvcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - Feb 10, 2023 at 03:55 AM
- Drop down
- What is drop box - Guide
- Display multiple columns in drop down list in excel - Guide
- Where is the safari drop down menu - Guide
- Virtualbox drag and drop - Guide
- Air drop wont work - Guide
2 responses
Feb 9, 2023 at 06:14 PM
Hello Moana,
Assuming that your drop downs are in Column A, try the following code placed into the worksheet module:-
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Columns(1)) Is Nothing Then Exit Sub If Target.Cells.Count > 1 Then Exit Sub If Target.Value = vbNullString Then Exit Sub Application.ScreenUpdating = False Application.EnableEvents = False Target.EntireRow.Copy Sheets(Target.Value).Range("A" & Rows.Count).End(3)(2) Application.EnableEvents = True Application.ScreenUpdating = True End Sub
The code is a Worksheet_Change event code and will work instantly once a drop down selection is made.
To implement this code:-
- Right click on the main input sheet tab.
- Select "View Code" from the menu that appears.
- In the big white code field that then appears, paste the above code.
If you need to delete the relevant row of data from the main input sheet after the data transfer is completed, place this line of code:-
Target.EntireRow.Delete
directly after this line of code:-
Target.EntireRow.Copy Sheets(Target.Value).Range("A" & Rows.Count).End(3)(2)
I hope that this helps.
Cheerio,
vcoolio.
Feb 10, 2023 at 03:55 AM
Hello Moana,
Every version of Excel has a "View Code" option in the context menu of any worksheet. Did you follow the instructions in post #1? Did you right click on the main sheet tab?
If you are still having problems, upload a sample of your workbook to a file sharing site such as WeTransfer or Drop Box and then post the link to your file back here. This way, we can have a look at what might not be working.
Cheerio,
vcoolio.
Feb 10, 2023 at 02:25 AM
Dear Vcoolio,
I am not able to add the code?
Can you please explain where to input the code? I don't have view code?
Best regards,