+ Reply to Thread
Results 1 to 12 of 12

Thread: Drop down lists

  1. #1
    Steve
    Guest

    Drop down lists

    Hi

    I'm kind of hoping that not toom much programming is required here.

    What I am trying to do is have a drop down list (not on a form but using the
    validation option) where the options are for example:

    AN - Delivery
    CU - Customer collection
    etc

    However, what I want to appear in the cell is just the first two letters. Is
    this possible?

    Many thanks

    --
    Steve R

  2. #2
    Duncan
    Guest

    Re: Drop down lists

    Steve,

    Can you not use the data validation and input the full text list, but
    resize the cell on the book so it is only big enough for 2 letters?

    Duncan


    Steve wrote:

    > Hi
    >
    > I'm kind of hoping that not toom much programming is required here.
    >
    > What I am trying to do is have a drop down list (not on a form but using the
    > validation option) where the options are for example:
    >
    > AN - Delivery
    > CU - Customer collection
    > etc
    >
    > However, what I want to appear in the cell is just the first two letters. Is
    > this possible?
    >
    > Many thanks
    >
    > --
    > Steve R



  3. #3
    Steve
    Guest

    Re: Drop down lists

    This may sound daft but there are other cells that all line up to make the
    whole sheet look nice.

    The other option is can you select a value from the list but have a value
    from another list put in the cell

    e.g

    Col A Col B
    ------ -------
    Deliver DL
    Customer Collect CC
    Hand Deliver HD
    Etc

    I would have Col A in the drop down but want to put the corresponding value
    in Col B.

    Hope this makes sense.

    Many thanks

    --
    Steve R


    "Duncan" wrote:

    > Steve,
    >
    > Can you not use the data validation and input the full text list, but
    > resize the cell on the book so it is only big enough for 2 letters?
    >
    > Duncan
    >
    >
    > Steve wrote:
    >
    > > Hi
    > >
    > > I'm kind of hoping that not toom much programming is required here.
    > >
    > > What I am trying to do is have a drop down list (not on a form but using the
    > > validation option) where the options are for example:
    > >
    > > AN - Delivery
    > > CU - Customer collection
    > > etc
    > >
    > > However, what I want to appear in the cell is just the first two letters. Is
    > > this possible?
    > >
    > > Many thanks
    > >
    > > --
    > > Steve R

    >
    >


  4. #4
    Duncan
    Guest

    Re: Drop down lists

    Steve,

    Do the validation for 2 letter codes and then put this code in,

    (The code would be long and messy and look something like this,)

    Private Sub Worksheet_Change(ByVal Target As Range)
    Set Rng = Range("C4")

    If Target = Rng Then
    If Target.Value = "HD" Then
    Target.Value = "Hand Deliver"
    End If
    If Target.Value = "DL" Then
    Target.Value = "Deliver"
    End If
    End If

    End Sub

    And you would have to add all of the ifs in for each name. There will
    be someone out there with a more efficient way because I am only a
    beginner, but this is how I would do it as not sure how to achieve it
    without code.

    Let us know how you get on with this.

    Duncan

    Steve wrote:

    > This may sound daft but there are other cells that all line up to make the
    > whole sheet look nice.
    >
    > The other option is can you select a value from the list but have a value
    > from another list put in the cell
    >
    > e.g
    >
    > Col A Col B
    > ------ -------
    > Deliver DL
    > Customer Collect CC
    > Hand Deliver HD
    > Etc
    >
    > I would have Col A in the drop down but want to put the corresponding value
    > in Col B.
    >
    > Hope this makes sense.
    >
    > Many thanks
    >
    > --
    > Steve R
    >
    >
    > "Duncan" wrote:
    >
    > > Steve,
    > >
    > > Can you not use the data validation and input the full text list, but
    > > resize the cell on the book so it is only big enough for 2 letters?
    > >
    > > Duncan
    > >
    > >
    > > Steve wrote:
    > >
    > > > Hi
    > > >
    > > > I'm kind of hoping that not toom much programming is required here.
    > > >
    > > > What I am trying to do is have a drop down list (not on a form but using the
    > > > validation option) where the options are for example:
    > > >
    > > > AN - Delivery
    > > > CU - Customer collection
    > > > etc
    > > >
    > > > However, what I want to appear in the cell is just the first two letters. Is
    > > > this possible?
    > > >
    > > > Many thanks
    > > >
    > > > --
    > > > Steve R

    > >
    > >



  5. #5
    Duncan
    Guest

    Re: Drop down lists

    Steve,

    I forgot to mention, Although the data validation will disallow invalid
    entries (anything other than HD or DL or etc) that the user attempts to
    type in, it will still allow the code to change the cell value, I dont
    know exactly why but VBA must bypass the validation which is good in
    this instance.

    Duncan


    Duncan wrote:

    > Steve,
    >
    > Do the validation for 2 letter codes and then put this code in,
    >
    > (The code would be long and messy and look something like this,)
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    > Set Rng = Range("C4")
    >
    > If Target = Rng Then
    > If Target.Value = "HD" Then
    > Target.Value = "Hand Deliver"
    > End If
    > If Target.Value = "DL" Then
    > Target.Value = "Deliver"
    > End If
    > End If
    >
    > End Sub
    >
    > And you would have to add all of the ifs in for each name. There will
    > be someone out there with a more efficient way because I am only a
    > beginner, but this is how I would do it as not sure how to achieve it
    > without code.
    >
    > Let us know how you get on with this.
    >
    > Duncan
    >
    > Steve wrote:
    >
    > > This may sound daft but there are other cells that all line up to make the
    > > whole sheet look nice.
    > >
    > > The other option is can you select a value from the list but have a value
    > > from another list put in the cell
    > >
    > > e.g
    > >
    > > Col A Col B
    > > ------ -------
    > > Deliver DL
    > > Customer Collect CC
    > > Hand Deliver HD
    > > Etc
    > >
    > > I would have Col A in the drop down but want to put the corresponding value
    > > in Col B.
    > >
    > > Hope this makes sense.
    > >
    > > Many thanks
    > >
    > > --
    > > Steve R
    > >
    > >
    > > "Duncan" wrote:
    > >
    > > > Steve,
    > > >
    > > > Can you not use the data validation and input the full text list, but
    > > > resize the cell on the book so it is only big enough for 2 letters?
    > > >
    > > > Duncan
    > > >
    > > >
    > > > Steve wrote:
    > > >
    > > > > Hi
    > > > >
    > > > > I'm kind of hoping that not toom much programming is required here.
    > > > >
    > > > > What I am trying to do is have a drop down list (not on a form but using the
    > > > > validation option) where the options are for example:
    > > > >
    > > > > AN - Delivery
    > > > > CU - Customer collection
    > > > > etc
    > > > >
    > > > > However, what I want to appear in the cell is just the first two letters. Is
    > > > > this possible?
    > > > >
    > > > > Many thanks
    > > > >
    > > > > --
    > > > > Steve R
    > > >
    > > >



  6. #6
    Steve
    Guest

    Re: Drop down lists

    Thanks Duncan

    I will have a go at this.

    Appreciate your time
    --
    Steve R


    "Duncan" wrote:

    > Steve,
    >
    > Do the validation for 2 letter codes and then put this code in,
    >
    > (The code would be long and messy and look something like this,)
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    > Set Rng = Range("C4")
    >
    > If Target = Rng Then
    > If Target.Value = "HD" Then
    > Target.Value = "Hand Deliver"
    > End If
    > If Target.Value = "DL" Then
    > Target.Value = "Deliver"
    > End If
    > End If
    >
    > End Sub
    >
    > And you would have to add all of the ifs in for each name. There will
    > be someone out there with a more efficient way because I am only a
    > beginner, but this is how I would do it as not sure how to achieve it
    > without code.
    >
    > Let us know how you get on with this.
    >
    > Duncan
    >
    > Steve wrote:
    >
    > > This may sound daft but there are other cells that all line up to make the
    > > whole sheet look nice.
    > >
    > > The other option is can you select a value from the list but have a value
    > > from another list put in the cell
    > >
    > > e.g
    > >
    > > Col A Col B
    > > ------ -------
    > > Deliver DL
    > > Customer Collect CC
    > > Hand Deliver HD
    > > Etc
    > >
    > > I would have Col A in the drop down but want to put the corresponding value
    > > in Col B.
    > >
    > > Hope this makes sense.
    > >
    > > Many thanks
    > >
    > > --
    > > Steve R
    > >
    > >
    > > "Duncan" wrote:
    > >
    > > > Steve,
    > > >
    > > > Can you not use the data validation and input the full text list, but
    > > > resize the cell on the book so it is only big enough for 2 letters?
    > > >
    > > > Duncan
    > > >
    > > >
    > > > Steve wrote:
    > > >
    > > > > Hi
    > > > >
    > > > > I'm kind of hoping that not toom much programming is required here.
    > > > >
    > > > > What I am trying to do is have a drop down list (not on a form but using the
    > > > > validation option) where the options are for example:
    > > > >
    > > > > AN - Delivery
    > > > > CU - Customer collection
    > > > > etc
    > > > >
    > > > > However, what I want to appear in the cell is just the first two letters. Is
    > > > > this possible?
    > > > >
    > > > > Many thanks
    > > > >
    > > > > --
    > > > > Steve R
    > > >
    > > >

    >
    >


  7. #7
    Steve
    Guest

    Re: Drop down lists

    Duncan

    Your a genious.

    Many thanks
    --
    Steve R


    "Duncan" wrote:

    > Steve,
    >
    > Do the validation for 2 letter codes and then put this code in,
    >
    > (The code would be long and messy and look something like this,)
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    > Set Rng = Range("C4")
    >
    > If Target = Rng Then
    > If Target.Value = "HD" Then
    > Target.Value = "Hand Deliver"
    > End If
    > If Target.Value = "DL" Then
    > Target.Value = "Deliver"
    > End If
    > End If
    >
    > End Sub
    >
    > And you would have to add all of the ifs in for each name. There will
    > be someone out there with a more efficient way because I am only a
    > beginner, but this is how I would do it as not sure how to achieve it
    > without code.
    >
    > Let us know how you get on with this.
    >
    > Duncan
    >
    > Steve wrote:
    >
    > > This may sound daft but there are other cells that all line up to make the
    > > whole sheet look nice.
    > >
    > > The other option is can you select a value from the list but have a value
    > > from another list put in the cell
    > >
    > > e.g
    > >
    > > Col A Col B
    > > ------ -------
    > > Deliver DL
    > > Customer Collect CC
    > > Hand Deliver HD
    > > Etc
    > >
    > > I would have Col A in the drop down but want to put the corresponding value
    > > in Col B.
    > >
    > > Hope this makes sense.
    > >
    > > Many thanks
    > >
    > > --
    > > Steve R
    > >
    > >
    > > "Duncan" wrote:
    > >
    > > > Steve,
    > > >
    > > > Can you not use the data validation and input the full text list, but
    > > > resize the cell on the book so it is only big enough for 2 letters?
    > > >
    > > > Duncan
    > > >
    > > >
    > > > Steve wrote:
    > > >
    > > > > Hi
    > > > >
    > > > > I'm kind of hoping that not toom much programming is required here.
    > > > >
    > > > > What I am trying to do is have a drop down list (not on a form but using the
    > > > > validation option) where the options are for example:
    > > > >
    > > > > AN - Delivery
    > > > > CU - Customer collection
    > > > > etc
    > > > >
    > > > > However, what I want to appear in the cell is just the first two letters. Is
    > > > > this possible?
    > > > >
    > > > > Many thanks
    > > > >
    > > > > --
    > > > > Steve R
    > > >
    > > >

    >
    >


  8. #8
    Steve
    Guest

    Re: Drop down lists

    Ah, Can I do this for multiple cells?

    I'm going to try using an If statement for the Range.

    Thanks
    --
    Steve R


    "Duncan" wrote:

    > Steve,
    >
    > Do the validation for 2 letter codes and then put this code in,
    >
    > (The code would be long and messy and look something like this,)
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    > Set Rng = Range("C4")
    >
    > If Target = Rng Then
    > If Target.Value = "HD" Then
    > Target.Value = "Hand Deliver"
    > End If
    > If Target.Value = "DL" Then
    > Target.Value = "Deliver"
    > End If
    > End If
    >
    > End Sub
    >
    > And you would have to add all of the ifs in for each name. There will
    > be someone out there with a more efficient way because I am only a
    > beginner, but this is how I would do it as not sure how to achieve it
    > without code.
    >
    > Let us know how you get on with this.
    >
    > Duncan
    >
    > Steve wrote:
    >
    > > This may sound daft but there are other cells that all line up to make the
    > > whole sheet look nice.
    > >
    > > The other option is can you select a value from the list but have a value
    > > from another list put in the cell
    > >
    > > e.g
    > >
    > > Col A Col B
    > > ------ -------
    > > Deliver DL
    > > Customer Collect CC
    > > Hand Deliver HD
    > > Etc
    > >
    > > I would have Col A in the drop down but want to put the corresponding value
    > > in Col B.
    > >
    > > Hope this makes sense.
    > >
    > > Many thanks
    > >
    > > --
    > > Steve R
    > >
    > >
    > > "Duncan" wrote:
    > >
    > > > Steve,
    > > >
    > > > Can you not use the data validation and input the full text list, but
    > > > resize the cell on the book so it is only big enough for 2 letters?
    > > >
    > > > Duncan
    > > >
    > > >
    > > > Steve wrote:
    > > >
    > > > > Hi
    > > > >
    > > > > I'm kind of hoping that not toom much programming is required here.
    > > > >
    > > > > What I am trying to do is have a drop down list (not on a form but using the
    > > > > validation option) where the options are for example:
    > > > >
    > > > > AN - Delivery
    > > > > CU - Customer collection
    > > > > etc
    > > > >
    > > > > However, what I want to appear in the cell is just the first two letters. Is
    > > > > this possible?
    > > > >
    > > > > Many thanks
    > > > >
    > > > > --
    > > > > Steve R
    > > >
    > > >

    >
    >


  9. #9
    Duncan
    Guest

    Re: Drop down lists

    Which would be your range of cells? (the only one I allowed for was C4
    but you can do the same to as many cells as you wish)

    Have a go at adding other cells to the range to be changed, I am sure
    you will manage but if not post back with more details and I'll happily
    have a go for you.

    Regards

    Duncan


    Steve wrote:

    > Ah, Can I do this for multiple cells?
    >
    > I'm going to try using an If statement for the Range.
    >
    > Thanks
    > --
    > Steve R
    >
    >
    > "Duncan" wrote:
    >
    > > Steve,
    > >
    > > Do the validation for 2 letter codes and then put this code in,
    > >
    > > (The code would be long and messy and look something like this,)
    > >
    > > Private Sub Worksheet_Change(ByVal Target As Range)
    > > Set Rng = Range("C4")
    > >
    > > If Target = Rng Then
    > > If Target.Value = "HD" Then
    > > Target.Value = "Hand Deliver"
    > > End If
    > > If Target.Value = "DL" Then
    > > Target.Value = "Deliver"
    > > End If
    > > End If
    > >
    > > End Sub
    > >
    > > And you would have to add all of the ifs in for each name. There will
    > > be someone out there with a more efficient way because I am only a
    > > beginner, but this is how I would do it as not sure how to achieve it
    > > without code.
    > >
    > > Let us know how you get on with this.
    > >
    > > Duncan
    > >
    > > Steve wrote:
    > >
    > > > This may sound daft but there are other cells that all line up to make the
    > > > whole sheet look nice.
    > > >
    > > > The other option is can you select a value from the list but have a value
    > > > from another list put in the cell
    > > >
    > > > e.g
    > > >
    > > > Col A Col B
    > > > ------ -------
    > > > Deliver DL
    > > > Customer Collect CC
    > > > Hand Deliver HD
    > > > Etc
    > > >
    > > > I would have Col A in the drop down but want to put the corresponding value
    > > > in Col B.
    > > >
    > > > Hope this makes sense.
    > > >
    > > > Many thanks
    > > >
    > > > --
    > > > Steve R
    > > >
    > > >
    > > > "Duncan" wrote:
    > > >
    > > > > Steve,
    > > > >
    > > > > Can you not use the data validation and input the full text list, but
    > > > > resize the cell on the book so it is only big enough for 2 letters?
    > > > >
    > > > > Duncan
    > > > >
    > > > >
    > > > > Steve wrote:
    > > > >
    > > > > > Hi
    > > > > >
    > > > > > I'm kind of hoping that not toom much programming is required here.
    > > > > >
    > > > > > What I am trying to do is have a drop down list (not on a form but using the
    > > > > > validation option) where the options are for example:
    > > > > >
    > > > > > AN - Delivery
    > > > > > CU - Customer collection
    > > > > > etc
    > > > > >
    > > > > > However, what I want to appear in the cell is just the first two letters. Is
    > > > > > this possible?
    > > > > >
    > > > > > Many thanks
    > > > > >
    > > > > > --
    > > > > > Steve R
    > > > >
    > > > >

    > >
    > >



  10. #10
    Duncan
    Guest

    Re: Drop down lists

    Oooops, just realised fatal error forgot to account for:

    If you select more than one cell and press delete key, it crashes out
    because the target is not one cell.

    at the begining of your code put:

    If Target.Count > 1 Then Exit Sub

    This will stop it from crashing out in this instance.

    Duncan



    Duncan wrote:

    > Which would be your range of cells? (the only one I allowed for was C4
    > but you can do the same to as many cells as you wish)
    >
    > Have a go at adding other cells to the range to be changed, I am sure
    > you will manage but if not post back with more details and I'll happily
    > have a go for you.
    >
    > Regards
    >
    > Duncan
    >
    >
    > Steve wrote:
    >
    > > Ah, Can I do this for multiple cells?
    > >
    > > I'm going to try using an If statement for the Range.
    > >
    > > Thanks
    > > --
    > > Steve R
    > >
    > >
    > > "Duncan" wrote:
    > >
    > > > Steve,
    > > >
    > > > Do the validation for 2 letter codes and then put this code in,
    > > >
    > > > (The code would be long and messy and look something like this,)
    > > >
    > > > Private Sub Worksheet_Change(ByVal Target As Range)
    > > > Set Rng = Range("C4")
    > > >
    > > > If Target = Rng Then
    > > > If Target.Value = "HD" Then
    > > > Target.Value = "Hand Deliver"
    > > > End If
    > > > If Target.Value = "DL" Then
    > > > Target.Value = "Deliver"
    > > > End If
    > > > End If
    > > >
    > > > End Sub
    > > >
    > > > And you would have to add all of the ifs in for each name. There will
    > > > be someone out there with a more efficient way because I am only a
    > > > beginner, but this is how I would do it as not sure how to achieve it
    > > > without code.
    > > >
    > > > Let us know how you get on with this.
    > > >
    > > > Duncan
    > > >
    > > > Steve wrote:
    > > >
    > > > > This may sound daft but there are other cells that all line up to make the
    > > > > whole sheet look nice.
    > > > >
    > > > > The other option is can you select a value from the list but have a value
    > > > > from another list put in the cell
    > > > >
    > > > > e.g
    > > > >
    > > > > Col A Col B
    > > > > ------ -------
    > > > > Deliver DL
    > > > > Customer Collect CC
    > > > > Hand Deliver HD
    > > > > Etc
    > > > >
    > > > > I would have Col A in the drop down but want to put the corresponding value
    > > > > in Col B.
    > > > >
    > > > > Hope this makes sense.
    > > > >
    > > > > Many thanks
    > > > >
    > > > > --
    > > > > Steve R
    > > > >
    > > > >
    > > > > "Duncan" wrote:
    > > > >
    > > > > > Steve,
    > > > > >
    > > > > > Can you not use the data validation and input the full text list, but
    > > > > > resize the cell on the book so it is only big enough for 2 letters?
    > > > > >
    > > > > > Duncan
    > > > > >
    > > > > >
    > > > > > Steve wrote:
    > > > > >
    > > > > > > Hi
    > > > > > >
    > > > > > > I'm kind of hoping that not toom much programming is required here.
    > > > > > >
    > > > > > > What I am trying to do is have a drop down list (not on a form but using the
    > > > > > > validation option) where the options are for example:
    > > > > > >
    > > > > > > AN - Delivery
    > > > > > > CU - Customer collection
    > > > > > > etc
    > > > > > >
    > > > > > > However, what I want to appear in the cell is just the first two letters. Is
    > > > > > > this possible?
    > > > > > >
    > > > > > > Many thanks
    > > > > > >
    > > > > > > --
    > > > > > > Steve R
    > > > > >
    > > > > >
    > > >
    > > >



  11. #11
    Steve
    Guest

    Re: Drop down lists

    Duncan

    It works prefectly with the code below accept fro one thing:

    When I delete either a value from any cell it brings up a 'Type Mismatch'
    error, highlighting the first If Statement (If Target = Range("G5") Then)

    Any Ideas?


    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target = Range("G5") Then

    If Target.Value = Worksheets("sheet2").Cells(2, 3) Then
    Target.Value = Worksheets("sheet2").Cells(2, 4)
    End If
    If Target.Value = Worksheets("sheet2").Cells(3, 3) Then
    Target.Value = Worksheets("sheet2").Cells(3, 4)
    End If
    If Target.Value = Worksheets("sheet2").Cells(4, 3) Then
    Target.Value = Worksheets("sheet2").Cells(4, 4)
    End If

    End If

    If Target = Range("AE6") Then

    If Target.Value = Worksheets("sheet2").Cells(2, 6) Then
    Target.Value = Worksheets("sheet2").Cells(2, 7)
    End If
    If Target.Value = Worksheets("sheet2").Cells(3, 6) Then
    Target.Value = Worksheets("sheet2").Cells(3, 7)
    End If
    If Target.Value = Worksheets("sheet2").Cells(4, 6) Then
    Target.Value = Worksheets("sheet2").Cells(4, 7)
    End If
    If Target.Value = Worksheets("sheet2").Cells(5, 6) Then
    Target.Value = Worksheets("sheet2").Cells(5, 7)
    End If

    If Target.Value = Worksheets("sheet2").Cells(6, 6) Then
    Target.Value = Worksheets("sheet2").Cells(6, 7)
    End If

    End If

    End Sub

    --
    Steve R


    "Duncan" wrote:

    > Which would be your range of cells? (the only one I allowed for was C4
    > but you can do the same to as many cells as you wish)
    >
    > Have a go at adding other cells to the range to be changed, I am sure
    > you will manage but if not post back with more details and I'll happily
    > have a go for you.
    >
    > Regards
    >
    > Duncan
    >
    >
    > Steve wrote:
    >
    > > Ah, Can I do this for multiple cells?
    > >
    > > I'm going to try using an If statement for the Range.
    > >
    > > Thanks
    > > --
    > > Steve R
    > >
    > >
    > > "Duncan" wrote:
    > >
    > > > Steve,
    > > >
    > > > Do the validation for 2 letter codes and then put this code in,
    > > >
    > > > (The code would be long and messy and look something like this,)
    > > >
    > > > Private Sub Worksheet_Change(ByVal Target As Range)
    > > > Set Rng = Range("C4")
    > > >
    > > > If Target = Rng Then
    > > > If Target.Value = "HD" Then
    > > > Target.Value = "Hand Deliver"
    > > > End If
    > > > If Target.Value = "DL" Then
    > > > Target.Value = "Deliver"
    > > > End If
    > > > End If
    > > >
    > > > End Sub
    > > >
    > > > And you would have to add all of the ifs in for each name. There will
    > > > be someone out there with a more efficient way because I am only a
    > > > beginner, but this is how I would do it as not sure how to achieve it
    > > > without code.
    > > >
    > > > Let us know how you get on with this.
    > > >
    > > > Duncan
    > > >
    > > > Steve wrote:
    > > >
    > > > > This may sound daft but there are other cells that all line up to make the
    > > > > whole sheet look nice.
    > > > >
    > > > > The other option is can you select a value from the list but have a value
    > > > > from another list put in the cell
    > > > >
    > > > > e.g
    > > > >
    > > > > Col A Col B
    > > > > ------ -------
    > > > > Deliver DL
    > > > > Customer Collect CC
    > > > > Hand Deliver HD
    > > > > Etc
    > > > >
    > > > > I would have Col A in the drop down but want to put the corresponding value
    > > > > in Col B.
    > > > >
    > > > > Hope this makes sense.
    > > > >
    > > > > Many thanks
    > > > >
    > > > > --
    > > > > Steve R
    > > > >
    > > > >
    > > > > "Duncan" wrote:
    > > > >
    > > > > > Steve,
    > > > > >
    > > > > > Can you not use the data validation and input the full text list, but
    > > > > > resize the cell on the book so it is only big enough for 2 letters?
    > > > > >
    > > > > > Duncan
    > > > > >
    > > > > >
    > > > > > Steve wrote:
    > > > > >
    > > > > > > Hi
    > > > > > >
    > > > > > > I'm kind of hoping that not toom much programming is required here.
    > > > > > >
    > > > > > > What I am trying to do is have a drop down list (not on a form but using the
    > > > > > > validation option) where the options are for example:
    > > > > > >
    > > > > > > AN - Delivery
    > > > > > > CU - Customer collection
    > > > > > > etc
    > > > > > >
    > > > > > > However, what I want to appear in the cell is just the first two letters. Is
    > > > > > > this possible?
    > > > > > >
    > > > > > > Many thanks
    > > > > > >
    > > > > > > --
    > > > > > > Steve R
    > > > > >
    > > > > >
    > > >
    > > >

    >
    >


  12. #12
    Steve
    Guest

    Re: Drop down lists

    This seems to have fixed the delete problem

    Thanks
    --
    Steve R


    "Duncan" wrote:

    > Oooops, just realised fatal error forgot to account for:
    >
    > If you select more than one cell and press delete key, it crashes out
    > because the target is not one cell.
    >
    > at the begining of your code put:
    >
    > If Target.Count > 1 Then Exit Sub
    >
    > This will stop it from crashing out in this instance.
    >
    > Duncan
    >
    >
    >
    > Duncan wrote:
    >
    > > Which would be your range of cells? (the only one I allowed for was C4
    > > but you can do the same to as many cells as you wish)
    > >
    > > Have a go at adding other cells to the range to be changed, I am sure
    > > you will manage but if not post back with more details and I'll happily
    > > have a go for you.
    > >
    > > Regards
    > >
    > > Duncan
    > >
    > >
    > > Steve wrote:
    > >
    > > > Ah, Can I do this for multiple cells?
    > > >
    > > > I'm going to try using an If statement for the Range.
    > > >
    > > > Thanks
    > > > --
    > > > Steve R
    > > >
    > > >
    > > > "Duncan" wrote:
    > > >
    > > > > Steve,
    > > > >
    > > > > Do the validation for 2 letter codes and then put this code in,
    > > > >
    > > > > (The code would be long and messy and look something like this,)
    > > > >
    > > > > Private Sub Worksheet_Change(ByVal Target As Range)
    > > > > Set Rng = Range("C4")
    > > > >
    > > > > If Target = Rng Then
    > > > > If Target.Value = "HD" Then
    > > > > Target.Value = "Hand Deliver"
    > > > > End If
    > > > > If Target.Value = "DL" Then
    > > > > Target.Value = "Deliver"
    > > > > End If
    > > > > End If
    > > > >
    > > > > End Sub
    > > > >
    > > > > And you would have to add all of the ifs in for each name. There will
    > > > > be someone out there with a more efficient way because I am only a
    > > > > beginner, but this is how I would do it as not sure how to achieve it
    > > > > without code.
    > > > >
    > > > > Let us know how you get on with this.
    > > > >
    > > > > Duncan
    > > > >
    > > > > Steve wrote:
    > > > >
    > > > > > This may sound daft but there are other cells that all line up to make the
    > > > > > whole sheet look nice.
    > > > > >
    > > > > > The other option is can you select a value from the list but have a value
    > > > > > from another list put in the cell
    > > > > >
    > > > > > e.g
    > > > > >
    > > > > > Col A Col B
    > > > > > ------ -------
    > > > > > Deliver DL
    > > > > > Customer Collect CC
    > > > > > Hand Deliver HD
    > > > > > Etc
    > > > > >
    > > > > > I would have Col A in the drop down but want to put the corresponding value
    > > > > > in Col B.
    > > > > >
    > > > > > Hope this makes sense.
    > > > > >
    > > > > > Many thanks
    > > > > >
    > > > > > --
    > > > > > Steve R
    > > > > >
    > > > > >
    > > > > > "Duncan" wrote:
    > > > > >
    > > > > > > Steve,
    > > > > > >
    > > > > > > Can you not use the data validation and input the full text list, but
    > > > > > > resize the cell on the book so it is only big enough for 2 letters?
    > > > > > >
    > > > > > > Duncan
    > > > > > >
    > > > > > >
    > > > > > > Steve wrote:
    > > > > > >
    > > > > > > > Hi
    > > > > > > >
    > > > > > > > I'm kind of hoping that not toom much programming is required here.
    > > > > > > >
    > > > > > > > What I am trying to do is have a drop down list (not on a form but using the
    > > > > > > > validation option) where the options are for example:
    > > > > > > >
    > > > > > > > AN - Delivery
    > > > > > > > CU - Customer collection
    > > > > > > > etc
    > > > > > > >
    > > > > > > > However, what I want to appear in the cell is just the first two letters. Is
    > > > > > > > this possible?
    > > > > > > >
    > > > > > > > Many thanks
    > > > > > > >
    > > > > > > > --
    > > > > > > > Steve R
    > > > > > >
    > > > > > >
    > > > >
    > > > >

    >
    >


+ 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.2.0