Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 114
Default Script doesn't work when cells are merged.

Thanks for the help in advance!!!!

Looking at the script below, when cell A1 is merged with another cell, the
script doesn't work.

How do i make it work, (irregardless wether its merge or not)

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Cells.Count 1 Then Exit Sub
If Len(Target.Value) 0 Then Exit Sub

Application.EnableEvents = False

If Target.Address = "$A$1" Then Target.Value = "This is merged cell (A1
merge to C3."

If Target.Address = "$B$1" Then Target.Value = "This is single cell"

Application.EnableEvents = True
End Sub

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 733
Default Script doesn't work when cells are merged.


wrote...
....
Looking at the script below, when cell A1 is merged with another cell, the
script doesn't work.


Helps if you mention how it doesn't work.

How do i make it work, (irregardless wether its merge or not)


What are you trying to do? Merged cells interact oddly with event
handlers. If you make an entry into a merged cell, the Target range
passed to the event handler is the single top-left cell of the merged
range. However, if you CLEAR a merged cell, the Target range passed to
the event handler is the entire merged range. PITA.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 114
Default Script doesn't work when cells are merged.

Hey Harlan, thanks for the advice.

How it doesn't work.?

With the script, when the delete button is hit for Cell B1, "This is single
cell" doesn't get erased. -Fixed Text after Deletion-

But when it's merged with more than one cell, somehow or rather it doesn't
work anymore.

I use it for dates, for example:

Cell A1: Dec-06 <=== hit delete

(cell A2 onwards)
Total USD Per Day
1-USDXXX (sumif(Cell A1 .....xxxxx)
2-USDXXX
3-USDXXX
4-USDXXX
5-USDXXX
6-USDXXX
7-USDXXX

1 to 31 days.

*Dec-06 (Cell A1) will be the month. And when I hit delete in cell A1 it
changes to Current Month(Jan-07) owing to date formula and the day result for
01 to 31 will change. -Fixed Text After Deletion-

This whay I can avoide the Pivot Table.

Now, I would like to use the script for Text, and sometimes the text exceeds
a single cell, like filling tax forms.

I am not proficient in VBA, I have acquired the script, but now a little
fine tuning. (Merged Cells)

And Hybrids (single and merged).

Thanks for your attention. I appreciate it.



"Harlan Grove" wrote:


wrote...
....
Looking at the script below, when cell A1 is merged with another cell, the
script doesn't work.


Helps if you mention how it doesn't work.

How do i make it work, (irregardless wether its merge or not)


What are you trying to do? Merged cells interact oddly with event
handlers. If you make an entry into a merged cell, the Target range
passed to the event handler is the single top-left cell of the merged
range. However, if you CLEAR a merged cell, the Target range passed to
the event handler is the entire merged range. PITA.


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
Calculating only non-empty cells... Jay Excel Worksheet Functions 9 September 22nd 06 03:20 AM
Conditional Formatting of merged cells, borders don't show correct pablo Excel Discussion (Misc queries) 5 September 21st 06 09:23 PM
Linking Merged Cells C. Cunningham Excel Worksheet Functions 2 December 27th 05 09:45 PM
merged cells into one text cell, size varies dependant on text dat Jazzylady825 Excel Discussion (Misc queries) 0 December 9th 05 08:26 PM
Getting Excel to treat merged cells as one cell when printing postitnote100 Excel Discussion (Misc queries) 1 June 24th 05 07:13 PM


All times are GMT +1. The time now is 10:35 AM.

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"