I am creating a macro where depending on the day of the year, it will either be OPEN or CLOSE...
However, I would like to know how can the words OPEN or CLOSE be inserted by the macro.
Example of the code:
However, I would like to know how can the words OPEN or CLOSE be inserted by the macro.
Example of the code:
Rich (BB code):
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdinsert_Click()
Set portugal = Worksheets("PORTUGAL")
Set priv= Worksheets("PRIVATE")
Set param= Worksheets("PARAMETERS")
Application.ScreenUpdating = False
If txtdate = "" Then
msg = "Please be sure all fields are complete"
MsgBox msg
GoTo Finish
End If
i = 0
Do
i = i + 1
Loop Until priv.Cells(i + 2, 1) = ""
If optopen = True Then word = OPEN 'NEED HELP HERE... These are option buttons
If optclose = True Then word = CLOSE 'NEED HELP HERE... These are option buttons
priv.Cells(i + 2, 1) = txtdate
priv.Cells(i + 2, 2) = "=WORKDAY(A" & (i + 2) & ",3,PARAMETERS!$D$3:$D$65536)"
priv.Cells(i + 2, 3) = word
Unload Me
Finish:
End Sub
Private Sub UserForm_Initialize()
Set portugal = Worksheets("PORTUGAL")
Set priv= Worksheets("PRIVATE")
Set param= Worksheets("PARAMETERS")
datetoday = Format(DateTime.Now, "mm/dd/yyyy")
txttradedate = datetoday
End Sub