I am not a coder, just a regular guy trying to use VBA to help me automate some tasks at work
I have this form that I am using to collect data, there is a combobox I am using for user to pick the time. I tried finding an easy date and time picker but was not able to find so I am having the user just type it in.
It works fine however, it seems like there is a more efficient way to write this code or to solve for the problem of picking the time, any suggestions?
I have this form that I am using to collect data, there is a combobox I am using for user to pick the time. I tried finding an easy date and time picker but was not able to find so I am having the user just type it in.
It works fine however, it seems like there is a more efficient way to write this code or to solve for the problem of picking the time, any suggestions?
VBA Code:
If ComboBoxTimes.value = "9am" Then
ActiveSheet.Range("O" & lRow) = "9:00"
Else
If ComboBoxTimes.value = "10am" Then
ActiveSheet.Range("O" & lRow) = "10:00"
Else
If ComboBoxTimes.value = "11am" Then
ActiveSheet.Range("O" & lRow) = "11:00"
Else
If ComboBoxTimes.value = "12pm" Then
ActiveSheet.Range("O" & lRow) = "12:00"
Else
If ComboBoxTimes.value = "1pm" Then
ActiveSheet.Range("O" & lRow) = "13:00"
Else
If ComboBoxTimes.value = "2pm" Then
ActiveSheet.Range("O" & lRow) = "14:00"
Else
If ComboBoxTimes.value = "3pm" Then
ActiveSheet.Range("O" & lRow) = "15:00"
Else
If ComboBoxTimes.value = "4pm" Then
ActiveSheet.Range("O" & lRow) = "16:00"
End If
End If
End If
End If
End If
End If
End If
End If