ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   defining an event procedure (lostfocus) that works on a column range (https://www.excelbanter.com/excel-programming/303573-defining-event-procedure-lostfocus-works-column-range.html)

juhlott

defining an event procedure (lostfocus) that works on a column range
 
I am trying to write an event procedure that works for an
entire column (lostfocus).

private sub a_LostFocus() works when I run the program
but not generally in excel

Bernie Deitrick

defining an event procedure (lostfocus) that works on a column range
 
juhlott,

You could use the selection change event, along the lines of this, to show
when at least one cell in column A is not selected:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Range("A:A"), Target) Is Nothing Then Exit Sub
MsgBox "You haven't selected a cell in column A"
End Sub

HTH,
Bernie
MS Excel MVP

"juhlott" wrote in message
...
I am trying to write an event procedure that works for an
entire column (lostfocus).

private sub a_LostFocus() works when I run the program
but not generally in excel





All times are GMT +1. The time now is 03:17 PM.

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