ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   XL2002 - SelectionChange Question... (https://www.excelbanter.com/excel-programming/418430-xl2002-selectionchange-question.html)

Trevor Williams

XL2002 - SelectionChange Question...
 
I need to trigger an 'autofit' event when the cursor 'exits' a cell, not
'enters' a cell. Here's the code I have so far

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("D8")) Is Nothing Then
Range("D8").EntireRow.AutoFit
End If
End Sub

So, basically, when a user enters text into, and then moves away from range
D8 the autofit line is executed. Currently it executes when the cusrsor
enters D8.

Any help apreciated.

Trevor Williams

Don Guillett

XL2002 - SelectionChange Question...
 
Try just deleting the selection
Private Sub Worksheet_SelectionChange(ByVal Target As Range
to
Private Sub Worksheet_Change(ByVal Target As Range
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Trevor Williams" wrote in
message ...
I need to trigger an 'autofit' event when the cursor 'exits' a cell, not
'enters' a cell. Here's the code I have so far

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("D8")) Is Nothing Then
Range("D8").EntireRow.AutoFit
End If
End Sub

So, basically, when a user enters text into, and then moves away from
range
D8 the autofit line is executed. Currently it executes when the cusrsor
enters D8.

Any help apreciated.

Trevor Williams



Trevor Williams

XL2002 - SelectionChange Question...
 
Hmmm, that's slightly embarrassing! LOL.
Thanks Don, it's a big help.

"Don Guillett" wrote:

Try just deleting the selection
Private Sub Worksheet_SelectionChange(ByVal Target As Range
to
Private Sub Worksheet_Change(ByVal Target As Range
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Trevor Williams" wrote in
message ...
I need to trigger an 'autofit' event when the cursor 'exits' a cell, not
'enters' a cell. Here's the code I have so far

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("D8")) Is Nothing Then
Range("D8").EntireRow.AutoFit
End If
End Sub

So, basically, when a user enters text into, and then moves away from
range
D8 the autofit line is executed. Currently it executes when the cusrsor
enters D8.

Any help apreciated.

Trevor Williams





All times are GMT +1. The time now is 04:15 AM.

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