#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Calendar

I have recently started teaching myself VBA and am still getting to grips
with it. I have created a calendar and its all working fine but how do I get
it to only pop up if they select a certain column or cell.

Regards
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Calendar

Maybe you could use a worksheet_selectionchange event.

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
If .Cells.Count 1 Then Exit Sub
If Intersect(.Cells, Me.Range("a:a")) Is Nothing Then
Exit Sub
Else
UserForm1.Show
End If
End With
End Sub

Or you could tie into a rightclick or doubleclick event.

You can read more about events at:
Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

Pasty wrote:

I have recently started teaching myself VBA and am still getting to grips
with it. I have created a calendar and its all working fine but how do I get
it to only pop up if they select a certain column or cell.

Regards


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Calendar

In the Worksheet_SelectionChange event hander, you'll need something like this:

If Target.Address = "$A$1" Then
'pop up your calendar when user selects cell A1
End If


If you wanted to pop up your calendar when a certain column is selected, you
do it like this:

If Target.Column = 1 Then
'pop up your calendar when user selects any cell in column A
End If


Note that the selectionchange event does not distinguish wether the cell was
selected via a mouse click or by moving the selection cursor with the
keyboard.



"Pasty" wrote:

I have recently started teaching myself VBA and am still getting to grips
with it. I have created a calendar and its all working fine but how do I get
it to only pop up if they select a certain column or cell.

Regards

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Calendar

Tried this out but I am getting nowhere with it.

"Dave Peterson" wrote:

Maybe you could use a worksheet_selectionchange event.

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
If .Cells.Count 1 Then Exit Sub
If Intersect(.Cells, Me.Range("a:a")) Is Nothing Then
Exit Sub
Else
UserForm1.Show
End If
End With
End Sub

Or you could tie into a rightclick or doubleclick event.

You can read more about events at:
Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

Pasty wrote:

I have recently started teaching myself VBA and am still getting to grips
with it. I have created a calendar and its all working fine but how do I get
it to only pop up if they select a certain column or cell.

Regards


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Calendar

Do you use the calendar control on a worksheet ?
See
http://www.rondebruin.nl/calendar.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Pasty" wrote in message ...
I have recently started teaching myself VBA and am still getting to grips
with it. I have created a calendar and its all working fine but how do I get
it to only pop up if they select a certain column or cell.

Regards



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Calendar

Ah, maybe it's time to add some more explanation.

Pasty wrote:

Tried this out but I am getting nowhere with it.

"Dave Peterson" wrote:

Maybe you could use a worksheet_selectionchange event.

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
If .Cells.Count 1 Then Exit Sub
If Intersect(.Cells, Me.Range("a:a")) Is Nothing Then
Exit Sub
Else
UserForm1.Show
End If
End With
End Sub

Or you could tie into a rightclick or doubleclick event.

You can read more about events at:
Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm

Pasty wrote:

I have recently started teaching myself VBA and am still getting to grips
with it. I have created a calendar and its all working fine but how do I get
it to only pop up if they select a certain column or cell.

Regards


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Calendar

Hi,

Yes it will be used on a worksheet. I have made the calendar in the user
forms bit and i have also got it set up so it automatically feeds into the
cells when clicked on, but I don't have any code to make it start up when I
click on the specific cells.

"Ron de Bruin" wrote:

Do you use the calendar control on a worksheet ?
See
http://www.rondebruin.nl/calendar.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Pasty" wrote in message ...
I have recently started teaching myself VBA and am still getting to grips
with it. I have created a calendar and its all working fine but how do I get
it to only pop up if they select a certain column or cell.

Regards


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Calendar

See Dave's example for column A


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Pasty" wrote in message ...
Hi,

Yes it will be used on a worksheet. I have made the calendar in the user
forms bit and i have also got it set up so it automatically feeds into the
cells when clicked on, but I don't have any code to make it start up when I
click on the specific cells.

"Ron de Bruin" wrote:

Do you use the calendar control on a worksheet ?
See
http://www.rondebruin.nl/calendar.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Pasty" wrote in message ...
I have recently started teaching myself VBA and am still getting to grips
with it. I have created a calendar and its all working fine but how do I get
it to only pop up if they select a certain column or cell.

Regards


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
Convert date from Gregorian Calendar to Hijri Calendar H.Alkhodary Excel Discussion (Misc queries) 1 February 21st 09 10:11 AM
find free sharware to include calendar pop or use calendar in cell ednc Excel Discussion (Misc queries) 2 April 14th 08 05:05 PM
how do i export excel calendar info to outlook calendar? Maggie Excel Discussion (Misc queries) 1 December 31st 07 10:27 PM
Modify Yearly Calendar to Monthly Calendar Excel 2000? James Cooper Excel Programming 13 July 13th 06 11:46 PM
import calendar items from excel into outlook calendar jsewaiseh Excel Discussion (Misc queries) 0 September 2nd 05 03:53 PM


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

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

About Us

"It's about Microsoft Excel"