Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Worksheet Selection Change

I have an if/then statement on the worksheet "Change"
method that checks the value of 'target' and acts
accordingly. It works except when you use 'Delete' to
empty out the cell. I get a data mismatch error. I'm
guessing it's because target can't equal 'null'. Is there
any way around this?

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Worksheet Selection Change

It would be most helpful if you posted the code that is causing the problem.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"DEFJ" wrote in message
...
I have an if/then statement on the worksheet "Change"
method that checks the value of 'target' and acts
accordingly. It works except when you use 'Delete' to
empty out the cell. I get a data mismatch error. I'm
guessing it's because target can't equal 'null'. Is there
any way around this?

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Worksheet Selection Change

if isempty(Target) then exit sub

at the top is a possibility.

or

if not isempty(target) then
' other checks

End if

--
Regards,
Tom Ogilvy

DEFJ wrote in message
...
I have an if/then statement on the worksheet "Change"
method that checks the value of 'target' and acts
accordingly. It works except when you use 'Delete' to
empty out the cell. I get a data mismatch error. I'm
guessing it's because target can't equal 'null'. Is there
any way around this?

Thanks in advance



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Worksheet Selection Change

thanks again- works great (saved me from an ActiveCell
workaround)
-----Original Message-----
if isempty(Target) then exit sub

at the top is a possibility.

or

if not isempty(target) then
' other checks

End if

--
Regards,
Tom Ogilvy

DEFJ wrote in

message
...
I have an if/then statement on the worksheet "Change"
method that checks the value of 'target' and acts
accordingly. It works except when you use 'Delete' to
empty out the cell. I get a data mismatch error. I'm
guessing it's because target can't equal 'null'. Is

there
any way around this?

Thanks in advance



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Worksheet Selection Change

I read this as trying to clear the contents of a range.

if you were doing
Target.delete

try:

Application.enableevents = false
target.clearcontents
application.enableevents = true

Disabling events means that changing the sheet in code doesn't cause the change
event to fire.



DEFJ wrote:

I have an if/then statement on the worksheet "Change"
method that checks the value of 'target' and acts
accordingly. It works except when you use 'Delete' to
empty out the cell. I get a data mismatch error. I'm
guessing it's because target can't equal 'null'. Is there
any way around this?

Thanks in advance


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick VBA Worksheet Change Event or Selection Question: Damil4real Excel Worksheet Functions 6 November 17th 09 10:28 PM
Lock worksheet, based on dropdown selection prior worksheet Michele New Users to Excel 9 June 21st 09 10:31 PM
CHANGE DEFAULT PRINT TO SELECTION INSTEAD OF ACTIVE WORKSHEET FRED SMITH New Users to Excel 2 June 27th 06 07:43 PM
Change row selection Farrel Excel Worksheet Functions 7 July 13th 05 06:58 PM
Selection Change question Chip Pearson Excel Programming 3 August 14th 03 05:16 PM


All times are GMT +1. The time now is 08:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"