ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cell value (https://www.excelbanter.com/excel-programming/432028-cell-value.html)

geebee

cell value
 
hi,

code is in worksheet selectionchange event. only want the code to run if
ONLY 1 cell is clicked, not a range of more than more than 1 cell. currently
have:

If Not Intersect(Target, Range("DATES_range")) Is Nothing Then
Dim selected_date1 As String
selected_date1 = Range(Target.Address).Value

thanks in advance,
geebee


OssieMac

cell value
 
Hello Geebee

If Target.Cells.Count 1 Then Exit Sub

--
Regards,

OssieMac


"geebee" wrote:

hi,

code is in worksheet selectionchange event. only want the code to run if
ONLY 1 cell is clicked, not a range of more than more than 1 cell. currently
have:

If Not Intersect(Target, Range("DATES_range")) Is Nothing Then
Dim selected_date1 As String
selected_date1 = Range(Target.Address).Value

thanks in advance,
geebee


Per Jessen[_2_]

cell value
 
Hi

Inset this line before the code you posted:

If Target.Cells.Count 1 then Exit Sub

Regards,
Per

On 5 Aug., 00:19, geebee (noSPAMs) wrote:
hi,

code is in worksheet selectionchange event. *only want the code to run if
ONLY 1 cell is clicked, not a range of more than more than 1 cell. *currently
have:

If Not Intersect(Target, Range("DATES_range")) Is Nothing Then
Dim selected_date1 As String
selected_date1 = Range(Target.Address).Value

thanks in advance,
geebee




All times are GMT +1. The time now is 05:28 AM.

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