Solved

If i keep on clicking i want to see more than two options.

Posted on 2016-09-15
7
46 Views
Last Modified: 2016-09-24
Hello Experts Exchange, I want to add more words to these code module. The code module show two words at this time, "" and "DONE" want to add "NOW"     "THEN"    and   "ZLAST" to the one that i currently have. So that when i keep on clicking on the button i would see ""  ,   "DONE",    "NOW",   "THEN",    "ZLAST". A total of five words, see one word every time i click on it. Thanks again Experts Exchange community for your help and time.

If UCase(Cells(ActiveCell.Row, "H")) = "DONE" Then
        Cells(ActiveCell.Row, "H") = ""
        
    Else
        Cells(ActiveCell.Row, "H") = "DONE"

Open in new window

0
Comment
Question by:Omar Hernandez
  • 5
  • 2
7 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 41800748
Is there an order that you want them to appear?

Would you instead just like the user to choose from a dropdown list?
0
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 41800755
Is this what you want? Note that in order to get it to change from one to another more than once, you need to select a different cell and the select the one in column H.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case UCase(Cells(ActiveCell.Row, "H"))
    Case ""
        Cells(ActiveCell.Row, "H") = "DONE"
    Case "DONE"
        Cells(ActiveCell.Row, "H") = "NOW"
    Case "NOW"
        Cells(ActiveCell.Row, "H") = "THEN"
    Case "THEN"
        Cells(ActiveCell.Row, "H") = "ZLAST"
    Case "ZLAST"
        Cells(ActiveCell.Row, "H") = ""
End Select

End Sub

Open in new window

0
 

Author Comment

by:Omar Hernandez
ID: 41800757
Thanks for your quick response it can appear like this.

After  ""  ,   "DONE"

The rest can follow
 "NOW",   "THEN",    "ZLAST"
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 46

Expert Comment

by:Martin Liss
ID: 41800760
Then see my code above.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 41800767
You may like this better.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case UCase(Cells(ActiveCell.Row, "H"))
    Case ""
        Cells(ActiveCell.Row, "H") = "DONE"
    Case "DONE"
        Cells(ActiveCell.Row, "H") = "NOW"
    Case "NOW"
        Cells(ActiveCell.Row, "H") = "THEN"
    Case "THEN"
        Cells(ActiveCell.Row, "H") = "ZLAST"
    Case "ZLAST"
        Cells(ActiveCell.Row, "H") = ""
End Select
Application.EnableEvents = False
Target.Offset(1, 0).Activate
Application.EnableEvents = True
End Sub

Open in new window

0
 

Author Closing Comment

by:Omar Hernandez
ID: 41813438
Work's great thanks a mil Martin Liss
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 41813760
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now