ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Calender Help (https://www.excelbanter.com/excel-worksheet-functions/54734-calender-help.html)

Alexanderj

Calender Help
 

Hi

Please can someone help me, i am designing an Excel worksheet to hold
dates and calculate days, i have two fields one for "start date" and
one for "end date" what i would like to know is, is it possible when a
cell is clicked under "start Date" a little calender pops up a date is
chosen and is displayed in the selected cell. If it is possible please
can someone help me.

Many thanks


--
Alexanderj
------------------------------------------------------------------------
Alexanderj's Profile: http://www.excelforum.com/member.php...o&userid=28704
View this thread: http://www.excelforum.com/showthread...hreadid=483870


[email protected]

Calender Help
 
This will require some VBA
two links where I learnt it from
http://www.rondebruin.nl/calendar.htm
http://www.fontstuff.com/vba/vbatut07.htm

hth RES

Peo Sjoblom

Calender Help
 
http://www.rondebruin.nl/calendar.htm

--

Regards,

Peo Sjoblom

"Alexanderj" wrote
in message ...

Hi

Please can someone help me, i am designing an Excel worksheet to hold
dates and calculate days, i have two fields one for "start date" and
one for "end date" what i would like to know is, is it possible when a
cell is clicked under "start Date" a little calender pops up a date is
chosen and is displayed in the selected cell. If it is possible please
can someone help me.

Many thanks


--
Alexanderj
------------------------------------------------------------------------
Alexanderj's Profile:

http://www.excelforum.com/member.php...o&userid=28704
View this thread: http://www.excelforum.com/showthread...hreadid=483870




swatsp0p

Calender Help
 

Alexanderj Wrote:
Hi

Please can someone help me, i am designing an Excel worksheet to hold
dates and calculate days, i have two fields one for "start date" and
one for "end date" what i would like to know is, is it possible when a
cell is clicked under "start Date" a little calender pops up a date is
chosen and is displayed in the selected cell. If it is possible please
can someone help me.

Many thanks


Try this:Private Sub Calendar1_Click()
ActiveCell.Value = CDbl(Calendar1.Value)
ActiveCell.NumberFormat = "dd-mmm" 'adjust this date format to meet
your needs
ActiveCell.Select
End Sub


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
' select Today's date in the Calendar
Calendar1.Value = Date
Else: Calendar1.Visible = False
End If
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

Adjust the 'Range("A1") line to meet your needs.

NOTE: use of an Event Code will probably make other functions
inoperable (e.g. cut/copy/paste, Undo, etc.). This is a trade off you
need to accept if you really want this tool.

Good Luck


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=483870



All times are GMT +1. The time now is 06:00 AM.

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