leatherhen99
New Member
- Joined
- Dec 17, 2019
- Messages
- 27
- Office Version
- 365
- Platform
- Windows
Hi All,
I have looked at so many different examples, but I'm not able to relate it back to my code. Here's what I have...
I was using an input box, but if the user spells something incorrectly, it could pose an issue... so I decided to use a form with radio buttons.
Please provide any feedback that seems off...
Module:
Enter_Month Form:
I would like the addmonth to be available in the remainder of the module code...but I can't figure out how to get it over there...
Any advice would be greatly appreciated!!!
Thanks,
Heather
I have looked at so many different examples, but I'm not able to relate it back to my code. Here's what I have...
I was using an input box, but if the user spells something incorrectly, it could pose an issue... so I decided to use a form with radio buttons.
Please provide any feedback that seems off...
Module:
VBA Code:
Public addmonth As String
Public Sub Setup()
'
' Setup Macro
'show Month Template tab
Worksheets("Month Template").Visible = True
'create a copy of the monthly template
Sheets("Month Template").Copy after:=Worksheets(Sheets.Count)
'ask user for the month being created; enter into cell A1
Static iba As String
With Enter_Month
.Show
End With
Enter_Month Form:
VBA Code:
Private Sub CommandButton1_Click()
Dim addmonth As String
If Enter_Month.OptionButton1.Value = True Then
addmonth = "January"
ElseIf Enter_Month.OptionButton2.Value = True Then
addmonth = "February"
ElseIf Enter_Month.OptionButton3.Value = True Then
addmonth = "March"
ElseIf Enter_Month.OptionButton4.Value = True Then
addmonth = "April"
ElseIf Enter_Month.OptionButton5.Value = True Then
addmonth = "May"
ElseIf Enter_Month.OptionButton6.Value = True Then
addmonth = "June"
ElseIf Enter_Month.OptionButton7.Value = True Then
addmonth = "July"
ElseIf Enter_Month.OptionButton8.Value = True Then
addmonth = "August"
ElseIf Enter_Month.OptionButton9.Value = True Then
addmonth = "September"
ElseIf Enter_Month.OptionButton10.Value = True Then
addmonth = "October"
ElseIf Enter_Month.OptionButton11.Value = True Then
addmonth = "November"
ElseIf Enter_Month.OptionButton12.Value = True Then
addmonth = "December"
End If
Range("A1").Value = addmonth
'rename the table with the initial input box
With ActiveSheet
.ListObjects(1).Name = addmonth
End With
'enter month and year into A6
Range("A6").Value = addmonth & Year(Date)
Me.Hide
I would like the addmonth to be available in the remainder of the module code...but I can't figure out how to get it over there...
Any advice would be greatly appreciated!!!
Thanks,
Heather