View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Data in f a Merged area

hi
no. when dealing with merged cell, you skew off into a totally different
concept.
note: i am totally opposed to using merged cells. dumbest thing excel
programers ever came up with. it may look pretty on the sheet but it screws
everthing else up.
so....stop using keywords that apply to unmerged cells(normal cells). use
keywords that do apply to merged cells. such as MergeCells...MergedArea. Oh!
didn't know about those. look them up in VB help.
to find merged cells on your sheet, use something like this.....
Sub isitmerged()
Dim c
For Each c In ActiveSheet.UsedRange
If c.MergeCells Then
MsgBox c.Address & " is merged"
End If
Next
End Sub
this does not solve your problem but does illistrate the problems created by
using merged cells. see note above.
to get the value of merged cells, make sure that all of the value are in the
upper left cell of the merged area. even though you see merged cells on the
sheet, excel is still seeing the grid and just making a side note about the
merged cells.
Sub whatisit()
Dim c As Range
Set c = Range("B2")
If c.MergeCells Then
mergedinfo = c.MergeArea
MsgBox c.Value
End If
End Sub

so once again, when using merged cells, even with vb, you are entering into
the...... "other" ......world.

in the long run, best not to even use merged cells. see note above.
if this doesn't make sense, do a google on merged cells to get more confused.

Regards
FSt1

"Bruce A. Julseth" wrote:

With VBA, how can I get the data for a merged area? I can reach a cell in
via "Offset" but don't know the boundaries and don't know the location of
Cell(1,1) of the merged area. Isn't the data located in Cell(1,1) of the
merged area?

Thanks for your help...


.