Dynamic dropdownlist from productlist

reiniervandijk1993

New Member
Joined
Apr 28, 2020
Messages
5
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Hi there,


I'm not good in programming and I hoped that people could help me on this platform.
I have made a macro that makes a productlist.
However some options of this productlist sometime need to be changed.
So I want a macro that scans my productlist and makes dropdownlists based on the list.

What this macro needs to do is:
  1. It has to search for a word from the (productlist) subjectlist in another sheet.
    1. To do this correctly a cell before the subjectcell contains always: frm .
      1. Something I can"t find is the lookup function that is as follows: frm >cell< - (cell to the right)- Subject >Cell<
  2. When cell is found then select till end > without the last row! named: Next
  3. Then it needs to make a defined name for the selection.
    1. Code
      1. Application.CutCopyMode = False
      2. Selection.CreateNames Top:=True, Left:=False, Bottom:=False, Right:=False
  4. When the name is made there has to come a dropdownlist made specially for the subject cell
  5. And then is has to loop till the end of the productlist.
The code is missing the loop and automatically search option and make dropdownlist.

VBA Code:
Sub test()
' test Macro
        Range("B4").Select
   
        Selection.Copy
   
        Range("C4").Select
   
        Cells.Find(What:="subject 1", After:=ActiveCell, LookIn:=xlFormulas2, _
                          LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
                          MatchCase:=False, SearchFormat:=False).Activate
   
        Sheets("Sheet1").Select
   
   Cells.FindNext(After:=ActiveCell).Activate
       Range(Selection, Selection.End(xlDown)).Select

   
    Application.CutCopyMode = False
        Selection.CreateNames Top:=True, Left:=False, Bottom:=False, Right:= _
            False


       Sheets("Sheet2").Select
       Range("C4").Select
   
       With Selection.Validation
              .Delete
              .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
                     xlBetween, Formula1:="=subject_1"
             .IgnoreBlank = False
             .InCellDropdown = True
             .InputTitle = ""
             .ErrorTitle = ""
             .InputMessage = ""
             .ErrorMessage = ""
             .ShowInput = True
             .ShowError = True
       End With
   
End Sub

This thread is also shared in where also a excel file attached:
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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