I have the following macro that I want to open when the user clicks cell b2,
which launches the calendar, then after they have selected the date and move
out of that cell the calendar closes.
Any help would be great
Here is the macro I want to start,
Sub OpenCalendar()
End SubHi JackR
You can use the Worksheet_SelectionChange event
If Not Application.Intersect(Range(quot;B2quot;), Target) Is Nothing Then
Tips for a calendar
www.rondebruin.nl/calendar.htm--
Regards Ron de Bruin
www.rondebruin.nlquot;JackRquot; gt; wrote in message ...
gt;I have the following macro that I want to open when the user clicks cell b2,
gt; which launches the calendar, then after they have selected the date and move
gt; out of that cell the calendar closes.
gt;
gt; Any help would be great
gt;
gt; Here is the macro I want to start,
gt;
gt; Sub OpenCalendar()
gt;
gt; End Sub
gt;
Everything works except that when the calendar pops up and I click on date
it will not enter the date. How can I e-mail you the actual spreadsheet so
you can look at it and see what I have done wrong??
quot;Ron de Bruinquot; wrote:
gt; Hi
gt;
gt; Copy this code in the Worksheet module:
gt; Right click on the sheet tab and choose view code.
gt; Paste the code in there and press Alt-Q to go back to Excel.
gt;
gt;
gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; If Not Application.Intersect(Range(quot;B2quot;), Target) Is Nothing Then
gt; Call OpenCalendar
gt; End If
gt; End Sub
gt;
gt; When you select B2 the macro OpenCalendar will run in the normal module
gt;
gt; --
gt; Regards Ron de Bruin
gt; www.rondebruin.nl
gt;
gt;
gt; quot;JackRquot; gt; wrote in message ...
gt; gt; Where would I place this line? I am very new to this.
gt; gt;
gt; gt;
gt; gt; quot;Ron de Bruinquot; wrote:
gt; gt;
gt; gt;gt; Hi JackR
gt; gt;gt;
gt; gt;gt; You can use the Worksheet_SelectionChange event
gt; gt;gt;
gt; gt;gt; If Not Application.Intersect(Range(quot;B2quot;), Target) Is Nothing Then
gt; gt;gt;
gt; gt;gt; Tips for a calendar
gt; gt;gt; www.rondebruin.nl/calendar.htm
gt; gt;gt;
gt; gt;gt;
gt; gt;gt; --
gt; gt;gt; Regards Ron de Bruin
gt; gt;gt; www.rondebruin.nl
gt; gt;gt;
gt; gt;gt;
gt; gt;gt; quot;JackRquot; gt; wrote in message ...
gt; gt;gt; gt;I have the following macro that I want to open when the user clicks cell b2,
gt; gt;gt; gt; which launches the calendar, then after they have selected the date and move
gt; gt;gt; gt; out of that cell the calendar closes.
gt; gt;gt; gt;
gt; gt;gt; gt; Any help would be great
gt; gt;gt; gt;
gt; gt;gt; gt; Here is the macro I want to start,
gt; gt;gt; gt;
gt; gt;gt; gt; Sub OpenCalendar()
gt; gt;gt; gt;
gt; gt;gt; gt; End Sub
gt; gt;gt; gt;
gt; gt;gt;
gt; gt;gt;
gt; gt;gt;
gt;
gt;
gt;
Don't know what you use, userform I think?
Have you try my code example Jack
www.rondebruin.nl/calendar.htm
--
Regards Ron de Bruin
www.rondebruin.nlquot;JackRquot; gt; wrote in message news
gt; Everything works except that when the calendar pops up and I click on date
gt; it will not enter the date. How can I e-mail you the actual spreadsheet so
gt; you can look at it and see what I have done wrong??
gt;
gt; quot;Ron de Bruinquot; wrote:
gt;
gt;gt; Hi
gt;gt;
gt;gt; Copy this code in the Worksheet module:
gt;gt; Right click on the sheet tab and choose view code.
gt;gt; Paste the code in there and press Alt-Q to go back to Excel.
gt;gt;
gt;gt;
gt;gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt;gt; If Not Application.Intersect(Range(quot;B2quot;), Target) Is Nothing Then
gt;gt; Call OpenCalendar
gt;gt; End If
gt;gt; End Sub
gt;gt;
gt;gt; When you select B2 the macro OpenCalendar will run in the normal module
gt;gt;
gt;gt; --
gt;gt; Regards Ron de Bruin
gt;gt; www.rondebruin.nl
gt;gt;
gt;gt;
gt;gt; quot;JackRquot; gt; wrote in message ...
gt;gt; gt; Where would I place this line? I am very new to this.
gt;gt; gt;
gt;gt; gt;
gt;gt; gt; quot;Ron de Bruinquot; wrote:
gt;gt; gt;
gt;gt; gt;gt; Hi JackR
gt;gt; gt;gt;
gt;gt; gt;gt; You can use the Worksheet_SelectionChange event
gt;gt; gt;gt;
gt;gt; gt;gt; If Not Application.Intersect(Range(quot;B2quot;), Target) Is Nothing Then
gt;gt; gt;gt;
gt;gt; gt;gt; Tips for a calendar
gt;gt; gt;gt; www.rondebruin.nl/calendar.htm
gt;gt; gt;gt;
gt;gt; gt;gt;
gt;gt; gt;gt; --
gt;gt; gt;gt; Regards Ron de Bruin
gt;gt; gt;gt; www.rondebruin.nl
gt;gt; gt;gt;
gt;gt; gt;gt;
gt;gt; gt;gt; quot;JackRquot; gt; wrote in message ...
gt;gt; gt;gt; gt;I have the following macro that I want to open when the user clicks cell b2,
gt;gt; gt;gt; gt; which launches the calendar, then after they have selected the date and move
gt;gt; gt;gt; gt; out of that cell the calendar closes.
gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt; Any help would be great
gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt; Here is the macro I want to start,
gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt; Sub OpenCalendar()
gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt; End Sub
gt;gt; gt;gt; gt;
gt;gt; gt;gt;
gt;gt; gt;gt;
gt;gt; gt;gt;
gt;gt;
gt;gt;
gt;gt;
I tried your code example, but I have 2 problems with it,
1. I need it to work with a sheet protected, which it would not do I got an
error message, is there a way to do this?
2. I need it to be a little smaller and not pop up right under the selected
cell, is there a way to move it?
If you can resolve these 2 issues your code is great.
quot;Ron de Bruinquot; wrote:
gt; Don't know what you use, userform I think?
gt;
gt; Have you try my code example Jack
gt; www.rondebruin.nl/calendar.htm
gt;
gt;
gt;
gt; --
gt; Regards Ron de Bruin
gt; www.rondebruin.nl
gt;
gt;
gt; quot;JackRquot; gt; wrote in message news
gt; gt; Everything works except that when the calendar pops up and I click on date
gt; gt; it will not enter the date. How can I e-mail you the actual spreadsheet so
gt; gt; you can look at it and see what I have done wrong??
gt; gt;
gt; gt; quot;Ron de Bruinquot; wrote:
gt; gt;
gt; gt;gt; Hi
gt; gt;gt;
gt; gt;gt; Copy this code in the Worksheet module:
gt; gt;gt; Right click on the sheet tab and choose view code.
gt; gt;gt; Paste the code in there and press Alt-Q to go back to Excel.
gt; gt;gt;
gt; gt;gt;
gt; gt;gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt; gt;gt; If Not Application.Intersect(Range(quot;B2quot;), Target) Is Nothing Then
gt; gt;gt; Call OpenCalendar
gt; gt;gt; End If
gt; gt;gt; End Sub
gt; gt;gt;
gt; gt;gt; When you select B2 the macro OpenCalendar will run in the normal module
gt; gt;gt;
gt; gt;gt; --
gt; gt;gt; Regards Ron de Bruin
gt; gt;gt; www.rondebruin.nl
gt; gt;gt;
gt; gt;gt;
gt; gt;gt; quot;JackRquot; gt; wrote in message ...
gt; gt;gt; gt; Where would I place this line? I am very new to this.
gt; gt;gt; gt;
gt; gt;gt; gt;
gt; gt;gt; gt; quot;Ron de Bruinquot; wrote:
gt; gt;gt; gt;
gt; gt;gt; gt;gt; Hi JackR
gt; gt;gt; gt;gt;
gt; gt;gt; gt;gt; You can use the Worksheet_SelectionChange event
gt; gt;gt; gt;gt;
gt; gt;gt; gt;gt; If Not Application.Intersect(Range(quot;B2quot;), Target) Is Nothing Then
gt; gt;gt; gt;gt;
gt; gt;gt; gt;gt; Tips for a calendar
gt; gt;gt; gt;gt; www.rondebruin.nl/calendar.htm
gt; gt;gt; gt;gt;
gt; gt;gt; gt;gt;
gt; gt;gt; gt;gt; --
gt; gt;gt; gt;gt; Regards Ron de Bruin
gt; gt;gt; gt;gt; www.rondebruin.nl
gt; gt;gt; gt;gt;
gt; gt;gt; gt;gt;
gt; gt;gt; gt;gt; quot;JackRquot; gt; wrote in message ...
gt; gt;gt; gt;gt; gt;I have the following macro that I want to open when the user clicks cell b2,
gt; gt;gt; gt;gt; gt; which launches the calendar, then after they have selected the date and move
gt; gt;gt; gt;gt; gt; out of that cell the calendar closes.
gt; gt;gt; gt;gt; gt;
gt; gt;gt; gt;gt; gt; Any help would be great
gt; gt;gt; gt;gt; gt;
gt; gt;gt; gt;gt; gt; Here is the macro I want to start,
gt; gt;gt; gt;gt; gt;
gt; gt;gt; gt;gt; gt; Sub OpenCalendar()
gt; gt;gt; gt;gt; gt;
gt; gt;gt; gt;gt; gt; End Sub
gt; gt;gt; gt;gt; gt;
gt; gt;gt; gt;gt;
gt; gt;gt; gt;gt;
gt; gt;gt; gt;gt;
gt; gt;gt;
gt; gt;gt;
gt; gt;gt;
gt;
gt;
gt;
Unlock the Date cells before you protect the sheet
Or protect you sheet with code
Copy this in the thisworkbook module and save /close/reopen the workbook
Private Sub Workbook_Open()
With Worksheets(quot;sheet1quot;)
.Protect Password:=quot;hiquot;, userinterfaceonly:=True
End With
End Subgt; 2. I need it to be a little smaller
Yes
Right click the control and look in Format object
gt; and not pop up right under the selected cell, is there a way to move it?
Change the code
Calendar1.Left = Target.Left Target.Width - Calendar1.Width
Calendar1.Top = Target.Top Target.Height
--
Regards Ron de Bruin
www.rondebruin.nlquot;JackRquot; gt; wrote in message ...
gt;I tried your code example, but I have 2 problems with it,
gt;
gt; 1. I need it to work with a sheet protected, which it would not do I got an
gt; error message, is there a way to do this?
gt;
gt; 2. I need it to be a little smaller and not pop up right under the selected
gt; cell, is there a way to move it?
gt;
gt; If you can resolve these 2 issues your code is great.
gt;
gt; quot;Ron de Bruinquot; wrote:
gt;
gt;gt; Don't know what you use, userform I think?
gt;gt;
gt;gt; Have you try my code example Jack
gt;gt; www.rondebruin.nl/calendar.htm
gt;gt;
gt;gt;
gt;gt;
gt;gt; --
gt;gt; Regards Ron de Bruin
gt;gt; www.rondebruin.nl
gt;gt;
gt;gt;
gt;gt; quot;JackRquot; gt; wrote in message news
gt;gt; gt; Everything works except that when the calendar pops up and I click on date
gt;gt; gt; it will not enter the date. How can I e-mail you the actual spreadsheet so
gt;gt; gt; you can look at it and see what I have done wrong??
gt;gt; gt;
gt;gt; gt; quot;Ron de Bruinquot; wrote:
gt;gt; gt;
gt;gt; gt;gt; Hi
gt;gt; gt;gt;
gt;gt; gt;gt; Copy this code in the Worksheet module:
gt;gt; gt;gt; Right click on the sheet tab and choose view code.
gt;gt; gt;gt; Paste the code in there and press Alt-Q to go back to Excel.
gt;gt; gt;gt;
gt;gt; gt;gt;
gt;gt; gt;gt; Private Sub Worksheet_SelectionChange(ByVal Target As Range)
gt;gt; gt;gt; If Not Application.Intersect(Range(quot;B2quot;), Target) Is Nothing Then
gt;gt; gt;gt; Call OpenCalendar
gt;gt; gt;gt; End If
gt;gt; gt;gt; End Sub
gt;gt; gt;gt;
gt;gt; gt;gt; When you select B2 the macro OpenCalendar will run in the normal module
gt;gt; gt;gt;
gt;gt; gt;gt; --
gt;gt; gt;gt; Regards Ron de Bruin
gt;gt; gt;gt; www.rondebruin.nl
gt;gt; gt;gt;
gt;gt; gt;gt;
gt;gt; gt;gt; quot;JackRquot; gt; wrote in message ...
gt;gt; gt;gt; gt; Where would I place this line? I am very new to this.
gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt; quot;Ron de Bruinquot; wrote:
gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt;gt; Hi JackR
gt;gt; gt;gt; gt;gt;
gt;gt; gt;gt; gt;gt; You can use the Worksheet_SelectionChange event
gt;gt; gt;gt; gt;gt;
gt;gt; gt;gt; gt;gt; If Not Application.Intersect(Range(quot;B2quot;), Target) Is Nothing Then
gt;gt; gt;gt; gt;gt;
gt;gt; gt;gt; gt;gt; Tips for a calendar
gt;gt; gt;gt; gt;gt; www.rondebruin.nl/calendar.htm
gt;gt; gt;gt; gt;gt;
gt;gt; gt;gt; gt;gt;
gt;gt; gt;gt; gt;gt; --
gt;gt; gt;gt; gt;gt; Regards Ron de Bruin
gt;gt; gt;gt; gt;gt; www.rondebruin.nl
gt;gt; gt;gt; gt;gt;
gt;gt; gt;gt; gt;gt;
gt;gt; gt;gt; gt;gt; quot;JackRquot; gt; wrote in message ...
gt;gt; gt;gt; gt;gt; gt;I have the following macro that I want to open when the user clicks cell b2,
gt;gt; gt;gt; gt;gt; gt; which launches the calendar, then after they have selected the date and move
gt;gt; gt;gt; gt;gt; gt; out of that cell the calendar closes.
gt;gt; gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt;gt; gt; Any help would be great
gt;gt; gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt;gt; gt; Here is the macro I want to start,
gt;gt; gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt;gt; gt; Sub OpenCalendar()
gt;gt; gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt;gt; gt; End Sub
gt;gt; gt;gt; gt;gt; gt;
gt;gt; gt;gt; gt;gt;
gt;gt; gt;gt; gt;gt;
gt;gt; gt;gt; gt;gt;
gt;gt; gt;gt;
gt;gt; gt;gt;
gt;gt; gt;gt;
gt;gt;
gt;gt;
gt;gt;
- Dec 18 Mon 2006 20:34
Macro to start when cell selected
close
全站熱搜
留言列表
發表留言