Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the folowwing code, and it works ok in most cases:
Private Sub Worksheet_Change(ByVal Target As Range) If ((Target.Column = 10) Or (Target.Column = 15)) Then If Not IsEmpty(Target) Or Target < "" Then MsgBox "The cell content has been changed" End If End If End Sub But if I delete something from a merged cell, in stead of just skipping the cell (not displaying the messagebox) I get a "Run-Time error '13': Type mismatch". This only happens on merged cells. Any idea how to avoid this? Jan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Then Exit Sub If Target.Column = 10 Or Target.Column = 15 Then If Not IsEmpty(Target) Or Target < "" Then MsgBox "The cell content has been changed" End If End If End Sub Mike "Jan Kronsell" wrote: I have the folowwing code, and it works ok in most cases: Private Sub Worksheet_Change(ByVal Target As Range) If ((Target.Column = 10) Or (Target.Column = 15)) Then If Not IsEmpty(Target) Or Target < "" Then MsgBox "The cell content has been changed" End If End If End Sub But if I delete something from a merged cell, in stead of just skipping the cell (not displaying the messagebox) I get a "Run-Time error '13': Type mismatch". This only happens on merged cells. Any idea how to avoid this? Jan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you. That did it :-)
Jan Jan Kronsell wrote: I have the folowwing code, and it works ok in most cases: Private Sub Worksheet_Change(ByVal Target As Range) If ((Target.Column = 10) Or (Target.Column = 15)) Then If Not IsEmpty(Target) Or Target < "" Then MsgBox "The cell content has been changed" End If End If End Sub But if I delete something from a merged cell, in stead of just skipping the cell (not displaying the messagebox) I get a "Run-Time error '13': Type mismatch". This only happens on merged cells. Any idea how to avoid this? Jan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
merged cells - code glitch | Excel Discussion (Misc queries) | |||
Autofit Merged cell Code is changing the format of my merged cells | Excel Discussion (Misc queries) | |||
Problem with code for merged cells | Excel Programming | |||
changing merged cells from code | Excel Programming | |||
Code doesn't work on merged cells | Excel Programming |