ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Single or Multiple Cell Selection (https://www.excelbanter.com/excel-programming/346694-single-multiple-cell-selection.html)

PosseJohn

Single or Multiple Cell Selection
 
Greetings...
I have a WS that contains code under 'Private Sub Worksheet_Change(ByVal
Target As Range)'

I only want to run the code if the user is changing contents of a single cell.

How do you detect if the user has selected multiple cells or not?

Gord Dibben

Single or Multiple Cell Selection
 
If Target.Count 1 Then Exit Sub 'or whatever


Gord Dibben Excel MVP

On Sun, 27 Nov 2005 09:17:19 -0800, PosseJohn
wrote:

Greetings...
I have a WS that contains code under 'Private Sub Worksheet_Change(ByVal
Target As Range)'

I only want to run the code if the user is changing contents of a single cell.

How do you detect if the user has selected multiple cells or not?



PosseJohn

Single or Multiple Cell Selection
 
THANX Gord, sometimes the easiest way isn't always obvious.

"Gord Dibben" wrote:

If Target.Count 1 Then Exit Sub 'or whatever


Gord Dibben Excel MVP

On Sun, 27 Nov 2005 09:17:19 -0800, PosseJohn
wrote:

Greetings...
I have a WS that contains code under 'Private Sub Worksheet_Change(ByVal
Target As Range)'

I only want to run the code if the user is changing contents of a single cell.

How do you detect if the user has selected multiple cells or not?





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

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