ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calendar Input (https://www.excelbanter.com/excel-programming/362088-calendar-input.html)

Brian Matlack[_77_]

Calendar Input
 

Hi!
I have a userform calendar that I want to input a date with. What I
want is:

1. The form to remain visible while I select another cell to input to.
2. The input cell must be in the range "Dates"

This is the code in the userform. This code does not work.
< code start
Option Explicit
Private Sub Calendar1_Click()

ActiveCell.NumberFormat = "mm/dd/yyyy"
If ActiveCell.Address = Range("Dates") Then
ActiveCell.Value = Calendar1.Value
Else
Exit Sub
End If
End Sub
< code stop

Any help or direction would be appreciated! Thanks!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=544355


Tom Ogilvy

Calendar Input
 
Option Explicit
Private Sub Calendar1_Click()
ActiveCell.NumberFormat = "mm/dd/yyyy"
If not Intersect(ActiveCell,Range("Dates")) is nothing then
ActiveCell.Value = Calendar1.Value
End if
End sub

--
Regards,
Tom Ogilvy



"Brian Matlack" wrote:


Hi!
I have a userform calendar that I want to input a date with. What I
want is:

1. The form to remain visible while I select another cell to input to.
2. The input cell must be in the range "Dates"

This is the code in the userform. This code does not work.
< code start
Option Explicit
Private Sub Calendar1_Click()

ActiveCell.NumberFormat = "mm/dd/yyyy"
If ActiveCell.Address = Range("Dates") Then
ActiveCell.Value = Calendar1.Value
Else
Exit Sub
End If
End Sub
< code stop

Any help or direction would be appreciated! Thanks!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=544355



Brian Matlack[_78_]

Calendar Input
 

Thanks Tom! The code works Great! I'll keep working on the problem with
keeping the userform visible while I select a different cell.
Thanks again!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=544355



All times are GMT +1. The time now is 02:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com