View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
CmK CmK is offline
external usenet poster
 
Posts: 69
Default SelectionChange problem

HI

I had the same problem long ago try this

If Target.Address = Range("CHECK.EX.PAYERS").Address And
Range("CHECK.EX.PAYERS").Mergearea.Cells(1,1).Valu e = "END EXISTING PAYERS
CHECK" Then:
Application.Run "PERSONAL.xls!END_EXISTING_PAYERS_CHECK"

Let me know if it does or doesnt work But i am pretty sure it does

Cheers


"Brettjg" wrote:

The following code works perfectly for a cell that is NOT merged:
If Target.Address = Range("CHECK.EX.PAYERS").Address And
Range("CHECK.EX.PAYERS").Value = "END EXISTING PAYERS CHECK" Then:
Application.Run "PERSONAL.xls!END_EXISTING_PAYERS_CHECK"

The following code also works perfectly for a cell range that IS MERGED:
If Target.Address = Range("CHECK.EX.PAYERS").Address Then: Application.Run
"PERSONAL.xls!END_EXISTING_PAYERS_CHECK"

What DOESN'T work for a MERGED cell range is:
If Target.Address = Range("CHECK.EX.PAYERS").Address And
Range("CHECK.EX.PAYERS").Value = "END EXISTING PAYERS CHECK" Then:
Application.Run "PERSONAL.xls!END_EXISTING_PAYERS_CHECK"

nor will any other statement like:
If Not Range("CHECK.EX.PAYERS").Value = "END EXISTING PAYERS CHECK" Then
Exit Sub
End If

I get an error 13 Type mismatch.
PLEASE NOTE: I have been careful to ensure that the named range of the
merged cells describes the whole range (not just the first cell).

Can someone please help. It's doing my head in (and it's already done in
from a cold!). Regards, Brett.