View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Merge Cell Question

If you don't know the extend of the merge, you could just ask:

Option Explicit
Sub testme()

Dim myMergeArea As Range
Dim myRng As Range

With Worksheets.Add
'some test ranges
Set myMergeArea = .Range("a1:d3")
myMergeArea.Merge

Set myRng = .Range("a1")
MsgBox myRng.Address & vbLf & myRng.MergeArea.Address
'myrng.mergearea will be the merged area range

If myRng.MergeCells Then
MsgBox "it's merged"
Else
MsgBox "it's not merged"
End If

myRng.Formula = "=c99"

End With

End Sub

And I could assign a formula without a problem.

crapit wrote:

If there are 3 columns of merge cell i.e A1 (A1 & A2), B1 (B1 & B2), C1
( C1 & C2 )
can i refer it as range("a1:c1")

As for formula, can it be used ay a merge cell?


--

Dave Peterson