+ Reply to Thread
Results 1 to 7 of 7

default drop box to a value?

  1. #1
    juan
    Guest

    default drop box to a value?

    Hello,
    I have a drop down box. Can I default it to a value? I
    have a macro and I have added a drop box, but would like
    it to default to a value. Right now, it leaves it blank.

    Please advise any feedback.

    Thanks,

    Juan

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good evening Juan

    Is your drop down box on a userform? If so, in the VBE select your drop down box object, and in the properties window find the property "Value". type in this box what you want your default value to be.

    Job done.

    HTH

    DominicB

  3. #3
    Robin Hammond
    Guest

    Re: default drop box to a value?

    Juan,

    set the listindex property, or less reliably, set the value property of the
    combobox. e.g. if the combo is on a form:

    Private Sub UserForm_Initialize()
    Dim lCount As Long
    With ComboBox1
    For lCount = 0 To 99
    .AddItem lCount
    Next lCount
    .ListIndex = 0
    'or not as reliable
    '.Value = 99
    End With
    End Sub

    Robin Hammond
    www.enhanceddatasystems.com

    "juan" <[email protected]> wrote in message
    news:[email protected]...
    > Hello,
    > I have a drop down box. Can I default it to a value? I
    > have a macro and I have added a drop box, but would like
    > it to default to a value. Right now, it leaves it blank.
    >
    > Please advise any feedback.
    >
    > Thanks,
    >
    > Juan




  4. #4
    Juan
    Guest

    Re: default drop box to a value?

    Hell Robin,
    thanks for the info, but I'm not using in a form. I
    created a macro to put the drop box on a sheet. Here's the
    macro portion:

    ActiveSheet.DropDowns.Add(111, 23.25, 75, 15.75).Select
    With Selection
    .Placement = xlFreeFloating
    .PrintObject = True
    End With
    With Selection
    .ListFillRange = "Sheet1!$P$2:$P$13"
    .LinkedCell = "$D$1"
    .DropDownLines = 8
    .Display3DShading = False
    End With

    What I want is to default it to let say Cell P2 from my
    list range.

    Please advise.
    Thank u for your time.

    Juan

    >-----Original Message-----
    >Juan,
    >
    >set the listindex property, or less reliably, set the

    value property of the
    >combobox. e.g. if the combo is on a form:
    >
    >Private Sub UserForm_Initialize()
    >Dim lCount As Long
    >With ComboBox1
    > For lCount = 0 To 99
    > .AddItem lCount
    > Next lCount
    > .ListIndex = 0
    > 'or not as reliable
    > '.Value = 99
    >End With
    >End Sub
    >
    >Robin Hammond
    >www.enhanceddatasystems.com
    >
    >"juan" <[email protected]> wrote in message
    >news:[email protected]...
    >> Hello,
    >> I have a drop down box. Can I default it to a value? I
    >> have a macro and I have added a drop box, but would like
    >> it to default to a value. Right now, it leaves it blank.
    >>
    >> Please advise any feedback.
    >>
    >> Thanks,
    >>
    >> Juan

    >
    >
    >.
    >


  5. #5
    Robin Hammond
    Guest

    Re: default drop box to a value?

    I've never actually done this before, but it looks like the value property

    Sub Test()
    ActiveSheet.DropDowns.Add(111, 23.25, 75, 15.75).Select
    With Selection
    .Placement = xlFreeFloating
    .PrintObject = True
    End With
    With Selection
    .ListFillRange = "Sheet1!$P$2:$P$13"
    .LinkedCell = "$D$1"
    .DropDownLines = 8
    .Display3DShading = False
    '*************add this
    .Value = 1
    '*******************
    End With
    End Sub

    Robin Hammond
    www.enhanceddatasystems.com

    "Juan" <[email protected]> wrote in message
    news:[email protected]...
    > Hell Robin,
    > thanks for the info, but I'm not using in a form. I
    > created a macro to put the drop box on a sheet. Here's the
    > macro portion:
    >
    > ActiveSheet.DropDowns.Add(111, 23.25, 75, 15.75).Select
    > With Selection
    > .Placement = xlFreeFloating
    > .PrintObject = True
    > End With
    > With Selection
    > .ListFillRange = "Sheet1!$P$2:$P$13"
    > .LinkedCell = "$D$1"
    > .DropDownLines = 8
    > .Display3DShading = False
    > End With
    >
    > What I want is to default it to let say Cell P2 from my
    > list range.
    >
    > Please advise.
    > Thank u for your time.
    >
    > Juan
    >
    >>-----Original Message-----
    >>Juan,
    >>
    >>set the listindex property, or less reliably, set the

    > value property of the
    >>combobox. e.g. if the combo is on a form:
    >>
    >>Private Sub UserForm_Initialize()
    >>Dim lCount As Long
    >>With ComboBox1
    >> For lCount = 0 To 99
    >> .AddItem lCount
    >> Next lCount
    >> .ListIndex = 0
    >> 'or not as reliable
    >> '.Value = 99
    >>End With
    >>End Sub
    >>
    >>Robin Hammond
    >>www.enhanceddatasystems.com
    >>
    >>"juan" <[email protected]> wrote in message
    >>news:[email protected]...
    >>> Hello,
    >>> I have a drop down box. Can I default it to a value? I
    >>> have a macro and I have added a drop box, but would like
    >>> it to default to a value. Right now, it leaves it blank.
    >>>
    >>> Please advise any feedback.
    >>>
    >>> Thanks,
    >>>
    >>> Juan

    >>
    >>
    >>.
    >>




  6. #6
    Juan
    Guest

    Re: default drop box to a value?

    Hello Robyn,
    it seems to work, but now my problme is that it stays the
    drop box seems to stay active. Have Squares around it, so
    my stops doesn't perform the rest. Is there a way around
    this?

    really appreciate all the help you are providing.

    Thanks,

    Juan
    >-----Original Message-----
    >I've never actually done this before, but it looks like

    the value property
    >
    >Sub Test()
    >ActiveSheet.DropDowns.Add(111, 23.25, 75, 15.75).Select
    > With Selection
    > .Placement = xlFreeFloating
    > .PrintObject = True
    > End With
    > With Selection
    > .ListFillRange = "Sheet1!$P$2:$P$13"
    > .LinkedCell = "$D$1"
    > .DropDownLines = 8
    > .Display3DShading = False
    > '*************add this
    > .Value = 1
    > '*******************
    > End With
    >End Sub
    >
    >Robin Hammond
    >www.enhanceddatasystems.com
    >
    >"Juan" <[email protected]> wrote in message
    >news:[email protected]...
    >> Hell Robin,
    >> thanks for the info, but I'm not using in a form. I
    >> created a macro to put the drop box on a sheet. Here's

    the
    >> macro portion:
    >>
    >> ActiveSheet.DropDowns.Add(111, 23.25, 75, 15.75).Select
    >> With Selection
    >> .Placement = xlFreeFloating
    >> .PrintObject = True
    >> End With
    >> With Selection
    >> .ListFillRange = "Sheet1!$P$2:$P$13"
    >> .LinkedCell = "$D$1"
    >> .DropDownLines = 8
    >> .Display3DShading = False
    >> End With
    >>
    >> What I want is to default it to let say Cell P2 from my
    >> list range.
    >>
    >> Please advise.
    >> Thank u for your time.
    >>
    >> Juan
    >>
    >>>-----Original Message-----
    >>>Juan,
    >>>
    >>>set the listindex property, or less reliably, set the

    >> value property of the
    >>>combobox. e.g. if the combo is on a form:
    >>>
    >>>Private Sub UserForm_Initialize()
    >>>Dim lCount As Long
    >>>With ComboBox1
    >>> For lCount = 0 To 99
    >>> .AddItem lCount
    >>> Next lCount
    >>> .ListIndex = 0
    >>> 'or not as reliable
    >>> '.Value = 99
    >>>End With
    >>>End Sub
    >>>
    >>>Robin Hammond
    >>>www.enhanceddatasystems.com
    >>>
    >>>"juan" <[email protected]> wrote in message
    >>>news:[email protected]...
    >>>> Hello,
    >>>> I have a drop down box. Can I default it to a value? I
    >>>> have a macro and I have added a drop box, but would

    like
    >>>> it to default to a value. Right now, it leaves it

    blank.
    >>>>
    >>>> Please advise any feedback.
    >>>>
    >>>> Thanks,
    >>>>
    >>>> Juan
    >>>
    >>>
    >>>.
    >>>

    >
    >
    >.
    >


  7. #7
    Tom Ogilvy
    Guest

    Re: default drop box to a value?

    Sub Test()
    With ActiveSheet.DropDowns.Add(111, 23.25, 75, 15.75)

    .Placement = xlFreeFloating
    .PrintObject = True
    .ListFillRange = "Sheet1!$P$2:$P$13"
    .LinkedCell = "$D$1"
    .DropDownLines = 8
    .Display3DShading = False
    '*************add this
    .Value = 1
    '*******************
    End With
    End Sub

    --
    Regards,
    Tom Ogilvy

    "Juan" <[email protected]> wrote in message
    news:[email protected]...
    > Hello Robyn,
    > it seems to work, but now my problme is that it stays the
    > drop box seems to stay active. Have Squares around it, so
    > my stops doesn't perform the rest. Is there a way around
    > this?
    >
    > really appreciate all the help you are providing.
    >
    > Thanks,
    >
    > Juan
    > >-----Original Message-----
    > >I've never actually done this before, but it looks like

    > the value property
    > >
    > >Sub Test()
    > >ActiveSheet.DropDowns.Add(111, 23.25, 75, 15.75).Select
    > > With Selection
    > > .Placement = xlFreeFloating
    > > .PrintObject = True
    > > End With
    > > With Selection
    > > .ListFillRange = "Sheet1!$P$2:$P$13"
    > > .LinkedCell = "$D$1"
    > > .DropDownLines = 8
    > > .Display3DShading = False
    > > '*************add this
    > > .Value = 1
    > > '*******************
    > > End With
    > >End Sub
    > >
    > >Robin Hammond
    > >www.enhanceddatasystems.com
    > >
    > >"Juan" <[email protected]> wrote in message
    > >news:[email protected]...
    > >> Hell Robin,
    > >> thanks for the info, but I'm not using in a form. I
    > >> created a macro to put the drop box on a sheet. Here's

    > the
    > >> macro portion:
    > >>
    > >> ActiveSheet.DropDowns.Add(111, 23.25, 75, 15.75).Select
    > >> With Selection
    > >> .Placement = xlFreeFloating
    > >> .PrintObject = True
    > >> End With
    > >> With Selection
    > >> .ListFillRange = "Sheet1!$P$2:$P$13"
    > >> .LinkedCell = "$D$1"
    > >> .DropDownLines = 8
    > >> .Display3DShading = False
    > >> End With
    > >>
    > >> What I want is to default it to let say Cell P2 from my
    > >> list range.
    > >>
    > >> Please advise.
    > >> Thank u for your time.
    > >>
    > >> Juan
    > >>
    > >>>-----Original Message-----
    > >>>Juan,
    > >>>
    > >>>set the listindex property, or less reliably, set the
    > >> value property of the
    > >>>combobox. e.g. if the combo is on a form:
    > >>>
    > >>>Private Sub UserForm_Initialize()
    > >>>Dim lCount As Long
    > >>>With ComboBox1
    > >>> For lCount = 0 To 99
    > >>> .AddItem lCount
    > >>> Next lCount
    > >>> .ListIndex = 0
    > >>> 'or not as reliable
    > >>> '.Value = 99
    > >>>End With
    > >>>End Sub
    > >>>
    > >>>Robin Hammond
    > >>>www.enhanceddatasystems.com
    > >>>
    > >>>"juan" <[email protected]> wrote in message
    > >>>news:[email protected]...
    > >>>> Hello,
    > >>>> I have a drop down box. Can I default it to a value? I
    > >>>> have a macro and I have added a drop box, but would

    > like
    > >>>> it to default to a value. Right now, it leaves it

    > blank.
    > >>>>
    > >>>> Please advise any feedback.
    > >>>>
    > >>>> Thanks,
    > >>>>
    > >>>> Juan
    > >>>
    > >>>
    > >>>.
    > >>>

    > >
    > >
    > >.
    > >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1