Extra button in Input popup

Sacruzsa

New Member
Joined
Feb 28, 2022
Messages
29
Office Version
  1. 2019
Platform
  1. Windows
Hello everyone,

Can anyone help me with the following problem?
I would like to add an extra button to a module, with the go to today function, is that possible?
The code in the module is now:

VBA Code:
Sub gotodate()
Dim tt As Long
Dim TheString As String, TheDate As Date
TheString = Application.InputBox("Enter A Date ##/##/2024 format")
If TheString = False Then Exit Sub
    If IsDate(TheString) Then
        TheDate = DateValue(TheString)
    Else
        MsgBox "Invalid date enter ##/##/2024 format"
    Exit Sub
    End If

Inarr = Range(Cells(11, 1), Cells(11, 750))
tt = TheDate
For i = 1 To 750
If tt = Inarr(1, i) Then
 Cells(11, i).Select
 Exit For
End If
Next i

End Sub
and looks like this:
Schermafbeelding 2024-01-31 124857.png

So I would like to have a 'Today' button to the left of the 'OK' button if possible
Thanks for the help
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Why not just populate your Input Box with a default value (which is one of the arguments) of the current date?, i.e.
Rich (BB code):
TheString = Application.InputBox("Enter A Date ##/##/2024 format", Default:=Date)
 
Upvote 0
You can't add buttons to the InputBox. You can create your own UserForm that mimics the InputBox. However, it will probably be easier to populate it with today's date as a default.

VBA Code:
TheString = Application.InputBox(prompt:="Enter A Date ##/##/2024 format", Default:=Format(Date, "mm/dd/yyyy"))
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,958
Members
449,096
Latest member
Anshu121

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