Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2016-09-15
7
Medium Priority
?
58 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 49

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 49

Accepted Solution

by:
Martin Liss earned 2000 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 49

Expert Comment

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

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 49

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
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 in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

971 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