ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Initiate a form on the selection of a particular cell of a workshe (https://www.excelbanter.com/excel-programming/347886-initiate-form-selection-particular-cell-workshe.html)

Stephane P

Initiate a form on the selection of a particular cell of a workshe
 
Hi,
I have made a form with a calendar and want to show the form when cell
"D3" is selected on a particular worksheet. Is there a straight forward way
to do this?

--
Thanks

Stephane

Bob Phillips[_6_]

Initiate a form on the selection of a particular cell of a workshe
 
Option Explicit

Private Sub Worksheet_SeelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "D3"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
frmCalendar.Show
End With
End If

ws_exit:
Application.EnableEvents = True
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.




--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Stephane P" wrote in message
...
Hi,
I have made a form with a calendar and want to show the form when cell
"D3" is selected on a particular worksheet. Is there a straight forward

way
to do this?

--
Thanks

Stephane




JMay

Initiate a form on the selection of a particular cell of a workshe
 
With Target <<<<<<<<
frmCalendar.Show
End With <<<<<<<<

Bob,
Why are these lines necessary (<<<<<<);
To E-x-p-a-n-d my understanding.


"Bob Phillips" wrote in message
...
Option Explicit

Private Sub Worksheet_SeelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "D3"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
frmCalendar.Show
End With
End If

ws_exit:
Application.EnableEvents = True
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.




--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Stephane P" wrote in message
...
Hi,
I have made a form with a calendar and want to show the form when cell
"D3" is selected on a particular worksheet. Is there a straight forward

way
to do this?

--
Thanks

Stephane






chijanzen

Initiate a form on the selection of a particular cell of a workshe
 
Stephane:

make Worksheet_SelectionChange


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address(0, 0) = "D3" Then
CaForm_Initialize
End If
End Sub

file download:
http://vba.holyou.net/file/9412121.xls

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Stephane P" wrote:

Hi,
I have made a form with a calendar and want to show the form when cell
"D3" is selected on a particular worksheet. Is there a straight forward way
to do this?

--
Thanks

Stephane


Stephane P

Initiate a form on the selection of a particular cell of a wor
 
It worked a treat. I thought there must be a simple way!
--
Thanks for your help

Stephane


"chijanzen" wrote:

Stephane:

make Worksheet_SelectionChange


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address(0, 0) = "D3" Then
CaForm_Initialize
End If
End Sub

file download:
http://vba.holyou.net/file/9412121.xls

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Stephane P" wrote:

Hi,
I have made a form with a calendar and want to show the form when cell
"D3" is selected on a particular worksheet. Is there a straight forward way
to do this?

--
Thanks

Stephane


Bob Phillips[_6_]

Initiate a form on the selection of a particular cell of a workshe
 
Jim,

They are not. I just amended a template event procedures, and didn't remove
them.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"JMay" wrote in message
news:IEenf.65857$_k3.34503@dukeread01...
With Target <<<<<<<<
frmCalendar.Show
End With <<<<<<<<

Bob,
Why are these lines necessary (<<<<<<);
To E-x-p-a-n-d my understanding.


"Bob Phillips" wrote in message
...
Option Explicit

Private Sub Worksheet_SeelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "D3"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
frmCalendar.Show
End With
End If

ws_exit:
Application.EnableEvents = True
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.




--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Stephane P" wrote in message
...
Hi,
I have made a form with a calendar and want to show the form when

cell
"D3" is selected on a particular worksheet. Is there a straight forward

way
to do this?

--
Thanks

Stephane









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

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