I am trying to be able to return a string from an array that will be put into a label in a userform. I've seen a lot of things for this, but none of them seem to work. I have an array named Compliments that I want to pull one of the strings for that array and pass it through to my label6 but because this is a userform that only shows up when the sheet is opened and is opened momentarily I want to be able to make it random. Each time someone opens the sheet they will get a different compliment to help start their day. My code for everything is below:
Private Sub UserForm_Activate()
TextBox1.Value = Date
TextBox2.Value = Time
TextBox3.Value = MainMenu.TextBox1.Value
Label6.Caption = "RANDOM ARRAY GOES HERE"
Application.Wait (Now + TimeValue("00:00:05"))
Welcome.Hide
End Sub
Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Top = (Application.Height / 2) - Me.Height / 2
Me.Left = (Application.Width / 2) - Me.Width / 2
Compliments = Array("Good Morning, You are Beautiful Today", _
"I think you're pretty awesome", "That outfit looks great on you", _
"You're a great engineer", "You rock Dude", "Nobody can get you down", _
"Your makeup is spot on")
End Sub
Aucun commentaire:
Enregistrer un commentaire