Need code for Input boxes

Tmoske

Board Regular
Joined
Jan 14, 2009
Messages
145
Need code that will open a input box and ask a user for a date and a count of users for that date. I can't install the Date picker add-in so I want the there to be some validation for the date format. Example: 01 JAN 12. I want the output's to be shown in the next empty cell in the range K8:K200 and L8:L200

Thanks in advance,
-Tmoske
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try this.
I did not know the sheet name so this defaults to whatever is the active sheet.

Code:
Sub user_input()
Dim kRng As Range
Dim usrDt As Variant
Dim usrNum As Variant
Dim myRow As Integer
    
    
    Set kRng = Range("K8:K200")
 
    usrDt = InputBox("Please Enter Date Here", "Enter DATE", "01 JAN 12")
        If IsDate(usrDt) Then
        Else
            MsgBox ("please enter Valid Date")
            Exit Sub
        End If
    usrNum = InputBox("Please enter count of Users for the day", "Coun of users", "#")
        If IsNumeric(usrNum) Then
            Else
            MsgBox ("please enter a valid number")
            Exit Sub
            End If
    myRow = Application.CountA(kRng)
    Range("K8").Offset(myRow).Value = usrDt
    Range("K8").Offset(myRow, 1).Value = usrNum
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top