Solved

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

Posted on 2016-09-15
7
52 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 47

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 47

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
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 47

Expert Comment

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

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 47

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Use Windows Task Scheduler to print a Word document weekly so your printer ink won't dry out.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

752 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