ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet_SelectionChange question (https://www.excelbanter.com/excel-programming/396043-worksheet_selectionchange-question.html)

Gary Keramidas

Worksheet_SelectionChange question
 
just wondering, i have a calendar control that fires on B2. but i notice when stepping through the code after the date is entered, this code fires , even though it exits because the target cell is not being changed.

a lot of processing is done on this sheet and i'm wondering if this slows things down.

--



Gary



Mike H

Worksheet_SelectionChange question
 
Gary,

The macro will be called for any worksheet change event but the amount of
code execution is usually controlled at the start of the macro with something
along the lines of

If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$B$2" Then

This ends the macro for 3 most common you wouldn't want it it execute.

1. More than 1 cell selected
2. The target cell has no value in
3. It's not the intended target cell.

Mike


"Gary Keramidas" wrote:

just wondering, i have a calendar control that fires on B2. but i notice when stepping through the code after the date is entered, this code fires , even though it exits because the target cell is not being changed.

a lot of processing is done on this sheet and i'm wondering if this slows things down.

--



Gary



Gary Keramidas

Worksheet_SelectionChange question
 
i have all of that, i'm saying it exits without doing anything, but it's
processed thousands of times. just wondering if it slows the code down.

--


Gary


"Mike H" wrote in message
...
Gary,

The macro will be called for any worksheet change event but the amount of
code execution is usually controlled at the start of the macro with something
along the lines of

If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$B$2" Then

This ends the macro for 3 most common you wouldn't want it it execute.

1. More than 1 cell selected
2. The target cell has no value in
3. It's not the intended target cell.

Mike


"Gary Keramidas" wrote:

just wondering, i have a calendar control that fires on B2. but i notice when
stepping through the code after the date is entered, this code fires , even
though it exits because the target cell is not being changed.

a lot of processing is done on this sheet and i'm wondering if this slows
things down.

--



Gary





Don Guillett

Worksheet_SelectionChange question
 
Maybe you want a worksheet_change event which fires when you change the cell instead of selecting it
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Gary Keramidas" <GKeramidasATmsn.com wrote in message ...
just wondering, i have a calendar control that fires on B2. but i notice when stepping through the code after the date is entered, this code fires , even though it exits because the target cell is not being changed.

a lot of processing is done on this sheet and i'm wondering if this slows things down.

--



Gary



Gary Keramidas

Worksheet_SelectionChange question
 
i want the calendar to pop up when the cell is clicked. but i've already deleted it, probably more trouble than it's worth.

thanks, don.

--


Gary


"Don Guillett" wrote in message ...
Maybe you want a worksheet_change event which fires when you change the cell instead of selecting it
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Gary Keramidas" <GKeramidasATmsn.com wrote in message ...
just wondering, i have a calendar control that fires on B2. but i notice when stepping through the code after the date is entered, this code fires , even though it exits because the target cell is not being changed.

a lot of processing is done on this sheet and i'm wondering if this slows things down.

--



Gary




All times are GMT +1. The time now is 01:34 AM.

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