Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6928073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:08:11+00:00 2026-05-27T11:08:11+00:00

Suppose that I have a catalog with shapes (Square, Circle, Triangle) and colors (red,

  • 0

Suppose that I have a catalog with shapes (Square, Circle, Triangle) and colors (red, blue, green). Each product has it’s unique code (SR = Red Square, TB= Blue Triangle, etc).
In column A, the user can input the catalog number, and in column B and C the shape and color, respectively.

What I want is that, if the user types the catalog number, then automatically B and C are filled (wich I know how to do), or alternatively, if the user doesn’t input the cat. number, then B and C have drop-down menus for him to choose.

I’ve been trying to create a function that does it, but I haven’t been able to succeed.

Here is what I’ve been doing:

Function DropDown(Clave As String)
    If Len(Clave) =0 Then
        With ActiveCell.Validation
            .Delete
            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
                xlBetween, Formula1:="=Shapes"
            .IgnoreBlank = True
            .InCellDropdown = True
            .InputTitle = ""
            .ErrorTitle = ""
            .InputMessage = ""
            .ErrorMessage = ""
            .ShowInput = True
            .ShowError = True
        End With
    Else
        'Code that finds the shape depending on Clave input
    End If
End Function

So far, I’ve managed to create a function that if the user inputs the cat. number, then the drop-downs only have one element with the correct choices, but the cells of the drop-downs are empty until the user selects the menus, wich defeats the purpose entirely. This could be solved if the drop-down could autoselect the only choice or, as defect, the first choice.

EDIT

The code above is capable of creating a drop-down if the input is empty, the problem is that a pop-up window immediatly shows that data is not consistent (wich is obvious, as it shows the function =DropDown(A1)). The other problem is that, if the user selects one of the options, the function gets erased from the cell and the functionality is loss.

I’ve been thinking of solutions to this problem, still to no avail. One thought is to run a macro that checks all drop-downs in the document, and if there is only one option on the list, the macro auto-select it. The thing is I want to do this on the fly, meaning that if the user inputs the cat. no. the drop-down option gets selected, but if he erases it, then the drop-down goes blank.

EDIT 2

I’ve been thinking that I can use an event changer that depends on the Cat. No. cell, to solve the issue. For example, suppose that A1 is the Cat. No. cell. If is empty, then in B1 and C1, the macro code detects the empty cell and creates the drop-downs for shapes and colors respectively. When the user types something in the cell, then the event changer detects it, and the macro fills the cells with the code information, as it detects A1 is no longer empty.

What do you guys think? I could really use some input here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:08:12+00:00Added an answer on May 27, 2026 at 11:08 am

    I ended up doing what I proposed on EDIT 2.

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Target.Worksheet.Range("A1")) Is Nothing Then
            If Range("A1") = "" Then
                Range("B1") = ""
                With Range("B1").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
                         xlBetween, Formula1:="=Shapes"
                    .IgnoreBlank = True
                    .InCellDropdown = True
                    .InputTitle = ""
                    .ErrorTitle = ""
                    .InputMessage = ""
                    .ErrorMessage = ""
                    .ShowInput = True
                    .ShowError = True
                End With                
                Range("C1") = ""
                With Range("C1").Validation
                    .Delete
                    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
                        xlBetween, Formula1:="=Colors"
                    .IgnoreBlank = True
                    .InCellDropdown = True
                    .InputTitle = ""
                    .ErrorTitle = ""
                    .InputMessage = ""
                    .ErrorMessage = ""
                    .ShowInput = True
                    .ShowError = True
                End With
            Else
                Range("B1").Validation.Delete
                Range("C1").Validation.Delete
                Range("B1") = 'Code that searches the correct shape depending on A1.
                Range("B1") = 'Code that searches the correct color depending on A1.
            End If
        End If
    End Sub
    

    Does anybody has a better solution?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose that i have 2 objects, where each one has a particular slot numbered
Suppose that I have an n -sided loaded die, where each side k has
Suppose that we have a class called class1. The class1 has a method called
Suppose that I have two data types Foo and Bar. Foo has fields x
So, I have a product that has custom options. In this case, its color.
Suppose that I have an ASP.NET page, where a customer can select a product
Suppose that you have two huge files (several GB) that you want to concatenate
Suppose that I have a Java program within an IDE (Eclipse in this case).
Suppose that I have a Java class with a static method, like so: class
Suppose that I have a request handler that accepts an argument: key And let

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.