<listbox name>.AddItem <value to be added>
'example - userform called formHome exists formHome.lstGuests.AddItem "Tristan Smith"
<listbox name>.AddItem <value to be added>
'example - userform called formHome exists formHome.lstGuests.AddItem "Tristan Smith"
Dim Sht As Worksheet For Each Sht In Worksheets Sht.Cells.Replace What:=<old value>, Replacement:=<new value>, LookAt:=xlPart, MatchCase:=False Next
'example - replaces all instances of person's name 'Old first/last name are in A1, B2 (respectively) in Sheet "Names" Dim Sht As Worksheet For Each Sht In Worksheets Sht.Cells.Replace What:=Sheets("MasterNames").Cells(1, 1).Value, Replacement:=txtNameFirst.Value, LookAt:=xlPart, MatchCase:=False Sht.Cells.Replace What:=Sheets("MasterNames").Cells(1, 2).Value, Replacement:=txtNameLast.Value, LookAt:=xlPart, MatchCase:=False Next
If <textbox name>.Value = "<value textbox should be>" Then <code to be run, provided correct textbox value was entered> End If
'example If txtName.Value = "" Then Msgbox ("No name was entered!") End If
<label’s name>.Caption = “<text>”
'example
lblExample.Caption = “Hello”
UCase(<value to be converted to upper case>) LCase(<value to be converted to lower case>)
‘examples MsgBox( LCase(“HELLO”)) ‘returns hello Range (“A1”) = UCase(Range(“A1”))
Range(“<your range>”).Value = “<your text here>”
Either of the three methods below will work:
Chr(10) vbNewLine vbCrLf
'example MsgBox "Line 1" & vbNewLine & "Line 2" & vbCrLf & "Line 3" & Chr(10) & "Line 4"
Please note: for Textboxes in userform design, make sure to set MultiLine to true or else new lines will not work.
<radio button name>.Value = <true or false>
‘example If radioVegetarian.Value = true Then MsgBox(“Your dinner will be a salad”) End If