ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   wrksheet selection change (https://www.excelbanter.com/excel-programming/424868-wrksheet-selection-change.html)

Brettjg

wrksheet selection change
 
The following code works perfectly in cell that is not merged:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("CHECK.NOTES").Address And
Range("CHECK.NOTES").Value = "END NOTES CHECK" Then
Application.Run "PERSONAL.xls!END_NOTES_CHECK"
End If
End Sub

but if the cell is merged it goes to debug. I have been careful to make sure
that the cell name is defined as the full merge range (eg $G$5:$J$6).
What am I missing please? Regards, Brett

joel

wrksheet selection change
 
Can you specify the error message and the line that failed. The problem
could be in the macro "PERSONAL.xls!END_NOTES_CHECK"

"Brettjg" wrote:

The following code works perfectly in cell that is not merged:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("CHECK.NOTES").Address And
Range("CHECK.NOTES").Value = "END NOTES CHECK" Then
Application.Run "PERSONAL.xls!END_NOTES_CHECK"
End If
End Sub

but if the cell is merged it goes to debug. I have been careful to make sure
that the cell name is defined as the full merge range (eg $G$5:$J$6).
What am I missing please? Regards, Brett


Brettjg

wrksheet selection change
 
Hi Joel, Error 13, Type Mismatch. The macro is dead simple:


Sub END_NOTES_CHECK()
With Range("CHECK.NOTES"): .Font.ColorIndex = 39: .Interior.ColorIndex =
39: .ClearContents: End With
ActiveWindow.View = xlPageBreakPreviewSheets("LAUNCHPAD").Select
Sheets("LAUNCHPAD").Shapes("GP final routine").ZOrder msoBringToFront
Sheets("LAUNCHPAD").Shapes("GP final msg").ZOrder msoBringToFront
ActiveWorkbook.Save
End Sub

Brett
"Joel" wrote:

Can you specify the error message and the line that failed. The problem
could be in the macro "PERSONAL.xls!END_NOTES_CHECK"

"Brettjg" wrote:

The following code works perfectly in cell that is not merged:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("CHECK.NOTES").Address And
Range("CHECK.NOTES").Value = "END NOTES CHECK" Then
Application.Run "PERSONAL.xls!END_NOTES_CHECK"
End If
End Sub

but if the cell is merged it goes to debug. I have been careful to make sure
that the cell name is defined as the full merge range (eg $G$5:$J$6).
What am I missing please? Regards, Brett


Brettjg

wrksheet selection change
 
In fact, it doesn't matter which cell I click, it goes to the same error. As
soon as I unmerge the cell, and change the name range it works perfectly
again. Brett.

"Joel" wrote:

Can you specify the error message and the line that failed. The problem
could be in the macro "PERSONAL.xls!END_NOTES_CHECK"

"Brettjg" wrote:

The following code works perfectly in cell that is not merged:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("CHECK.NOTES").Address And
Range("CHECK.NOTES").Value = "END NOTES CHECK" Then
Application.Run "PERSONAL.xls!END_NOTES_CHECK"
End If
End Sub

but if the cell is merged it goes to debug. I have been careful to make sure
that the cell name is defined as the full merge range (eg $G$5:$J$6).
What am I missing please? Regards, Brett


Brettjg

wrksheet selection change
 
Hi Joel, a little bit me more info: if I unmerge the cells and leave the name
range as $G$5:$G$6 it goes to the same error (and also on any cell that I
click). Not sure if that helps. Brett

"Joel" wrote:

Can you specify the error message and the line that failed. The problem
could be in the macro "PERSONAL.xls!END_NOTES_CHECK"

"Brettjg" wrote:

The following code works perfectly in cell that is not merged:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Range("CHECK.NOTES").Address And
Range("CHECK.NOTES").Value = "END NOTES CHECK" Then
Application.Run "PERSONAL.xls!END_NOTES_CHECK"
End If
End Sub

but if the cell is merged it goes to debug. I have been careful to make sure
that the cell name is defined as the full merge range (eg $G$5:$J$6).
What am I missing please? Regards, Brett



All times are GMT +1. The time now is 01:57 AM.

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