View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Horatio J. Bilge, Jr. Horatio J. Bilge, Jr. is offline
external usenet poster
 
Posts: 135
Default merged cells - code glitch

Yep. They are formatted and merged the same.


"Mark Lincoln" wrote:

This is a wild guess (I'm sorry that I have no time to test it
myself): Are the cells in Sheet3 formatted the same as those in the
sheet in question? That is, are cells in Sheet3 merged the same way?
That might work or it might not, but that's the first thing I'd try.

Mark Lincoln

On Oct 9, 3:21 pm, Horatio J. Bilge, Jr.
wrote:
I have a glitch in my code. The purpose of the code is to protect the
formulas in cells on Sheet1, while still allowing a specific text entry
("Ex"). And if a user then chooses to delete the "Ex" the cell will revert
back to the original formula, by retrieving it from Sheet3.

My code works well in single cells. But I have in some merged cells (e.g.,
E5 is merged from E5 and E6), and there is a glitch in the code. In those
cells, pressing the delete key actually deletes the contents of the cells,
and results in an error. If I delete the cell by pressing 'backspace' and
then 'enter' the code works as expected.

Here is my code:
If Application.Intersect(Target, Range("E5:E49")) Is Nothing Then
Exit Sub
End If
If Target.Value < "Ex" Then
Application.EnableEvents = False
Target.Formula = Sheets("Sheet3").Cells(Target.Row,
Target.Column).Formula
Application.EnableEvents = True
End If
Exit Sub