VBA Help!!!

Lutoniall

New member
Local time
Today, 16:48
Joined
Nov 2, 2007
Messages
5
I am a complete beginner in VBA so could you help with this.

I have a seven segment LCD display which are really lines to make it look like it. What I need is to make the numbers go to 199.9, so my display looks like XXX.X. I have done the code so far 1-9:

Private Sub Change_Number_Click()
Line1.Visible = False
Line2.Visible = False
Line3.Visible = False
Line4.Visible = False
Line5.Visible = False
Line6.Visible = False
Line7.Visible = Fasle
Line8.Visible = False
Line9.Visible = False
Line10.Visible = False
Line11.Visible = False
Line12.Visible = False
Line13.Visible = False
Line14.Visible = Fasle

Number = InputBox("Enter the number to display")

Select Case Number

Case 0
Line1.Visible = True
Line2.Visible = True
Line3.Visible = True
Line4.Visible = True
Line5.Visible = True
Line6.Visible = True
Line7.Visible = False

Case 1
Line1.Visible = False
Line2.Visible = False
Line3.Visible = True
Line4.Visible = True
Line5.Visible = False
Line6.Visible = False
Line7.Visible = False

Case 2
Line1.Visible = False
Line2.Visible = True
Line3.Visible = True
Line4.Visible = False
Line5.Visible = True
Line6.Visible = True
Line7.Visible = True

Case 3
Line1.Visible = False
Line2.Visible = True
Line3.Visible = True
Line4.Visible = True
Line5.Visible = True
Line6.Visible = False
Line7.Visible = True

Etc.. on to case 9 (This is not in the code )
End Select
End Sub

So how do I make it go to 199.9 without writing out case 1 to 199.9 as this would take a long time. Many Thanks!!!
 
Looks like a challenge. I'm prepared to give it a try.
 
This is quick and dirty, but it was fun. I think I could have done it faster or more efficiently, but I kept getting distracted by boss-man's avatar. :p
 

Attachments

I'm impressed too! That was very cool.

The MVP title is too little I am thinking. :D
 
Thanks guys; it was an interesting challenge. Probably school work, but it was fun anyway. There are probably any number of neat ways to do it, but my first thought was looping the tag property so I ran with it.
 
Thanks for all this infomation a lot of help!!! But is there any way of clicking on a command button then brings up a inputbox, when change the display that way?
 
Thanks for all this infomation a lot of help!!! But is there any way of clicking on a command button then brings up a inputbox, when change the display that way?

Ah come on - sheesh. A little bit of exploration in the help files would have gotten you that. I'm afraid you are very lazy and it's too bad OldSoftBoss actually did it for you.

That is very simple and basic stuff. So, I guess the only thing you'll learn from this is that you can ask and people will do it all for you. :(
 

Users who are viewing this thread

Back
Top Bottom