Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
JackR
 
Posts: n/a
Default Macro to start when cell selected

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 Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin
 
Posts: n/a
Default Macro to start when cell selected

Hi JackR

You can use the Worksheet_SelectionChange event

If Not Application.Intersect(Range("B2"), Target) Is Nothing Then

Tips for a calendar
http://www.rondebruin.nl/calendar.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
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 Sub



  #3   Report Post  
Posted to microsoft.public.excel.misc
JackR
 
Posts: n/a
Default Macro to start when cell selected

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??

"Ron de Bruin" wrote:

Hi

Copy this code in the Worksheet module:
Right click on the sheet tab and choose view code.
Paste the code in there and press Alt-Q to go back to Excel.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("B2"), Target) Is Nothing Then
Call OpenCalendar
End If
End Sub

When you select B2 the macro OpenCalendar will run in the normal module

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
Where would I place this line? I am very new to this.


"Ron de Bruin" wrote:

Hi JackR

You can use the Worksheet_SelectionChange event

If Not Application.Intersect(Range("B2"), Target) Is Nothing Then

Tips for a calendar
http://www.rondebruin.nl/calendar.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
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 Sub







  #4   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin
 
Posts: n/a
Default Macro to start when cell selected

Don't know what you use, userform I think?

Have you try my code example Jack
http://www.rondebruin.nl/calendar.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
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??

"Ron de Bruin" wrote:

Hi

Copy this code in the Worksheet module:
Right click on the sheet tab and choose view code.
Paste the code in there and press Alt-Q to go back to Excel.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("B2"), Target) Is Nothing Then
Call OpenCalendar
End If
End Sub

When you select B2 the macro OpenCalendar will run in the normal module

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
Where would I place this line? I am very new to this.


"Ron de Bruin" wrote:

Hi JackR

You can use the Worksheet_SelectionChange event

If Not Application.Intersect(Range("B2"), Target) Is Nothing Then

Tips for a calendar
http://www.rondebruin.nl/calendar.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
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 Sub









  #5   Report Post  
Posted to microsoft.public.excel.misc
JackR
 
Posts: n/a
Default Macro to start when cell selected

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.

"Ron de Bruin" wrote:

Don't know what you use, userform I think?

Have you try my code example Jack
http://www.rondebruin.nl/calendar.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
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??

"Ron de Bruin" wrote:

Hi

Copy this code in the Worksheet module:
Right click on the sheet tab and choose view code.
Paste the code in there and press Alt-Q to go back to Excel.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("B2"), Target) Is Nothing Then
Call OpenCalendar
End If
End Sub

When you select B2 the macro OpenCalendar will run in the normal module

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
Where would I place this line? I am very new to this.


"Ron de Bruin" wrote:

Hi JackR

You can use the Worksheet_SelectionChange event

If Not Application.Intersect(Range("B2"), Target) Is Nothing Then

Tips for a calendar
http://www.rondebruin.nl/calendar.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
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 Sub












  #6   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin
 
Posts: n/a
Default Macro to start when cell selected

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("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
End With
End Sub


2. I need it to be a little smaller


Yes
Right click the control and look in Format object

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
http://www.rondebruin.nl


"JackR" wrote in message ...
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.

"Ron de Bruin" wrote:

Don't know what you use, userform I think?

Have you try my code example Jack
http://www.rondebruin.nl/calendar.htm



--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
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??

"Ron de Bruin" wrote:

Hi

Copy this code in the Worksheet module:
Right click on the sheet tab and choose view code.
Paste the code in there and press Alt-Q to go back to Excel.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("B2"), Target) Is Nothing Then
Call OpenCalendar
End If
End Sub

When you select B2 the macro OpenCalendar will run in the normal module

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
Where would I place this line? I am very new to this.


"Ron de Bruin" wrote:

Hi JackR

You can use the Worksheet_SelectionChange event

If Not Application.Intersect(Range("B2"), Target) Is Nothing Then

Tips for a calendar
http://www.rondebruin.nl/calendar.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JackR" wrote in message ...
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 Sub












Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Row Expansion Susan Excel Worksheet Functions 11 February 28th 06 07:15 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
enter data in cell which will start macro to move data to sheet2 Tommy Excel Discussion (Misc queries) 0 May 12th 05 05:00 PM
Can I start a macro from a cell by using a formula PraxisPete Excel Worksheet Functions 1 April 8th 05 08:57 AM


All times are GMT +1. The time now is 12:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"