In VBA I can merge two cells in one column after selecting both cells with the Refedit. But if I try to move to the next column and try to merge the same two rows under the same sub procedure, nothing happens. I've tried just about everthing I can think of including offset. Ultimately what I am trying to do is merge two rows in multiple columns but each column has to be merged separately. To get me started I did use the macro recorder in order to get some information. Selected two rows(10 & 11) in column A, did the format, merge and then selected the column B rows (10 & 11). Here is what I have so far.
Private Sub CommandButton1_Click()
Dim StrAddr As String
StrAddr = RefEdit1.Value
Range(StrAddr).MergeCells = True
End Sub
If I try the offset function, it will merge what ever offset I select but will not merge both the original selected rows and the offset rows.
Private Sub CommandButton1_Click()
Dim StrAddr As String
Dim UserRange1 As Range
StrAddr = RefEdit1.Value
Set UserRange1 = Range(StrAddr)
UserRange1.Offset(0, 0).MergeCells = True
UserRange1.Offset(0, 1).MergeCells = True
End Sub
Private Sub CommandButton1_Click()
Dim StrAddr As String
StrAddr = RefEdit1.Value
Range(StrAddr).MergeCells = True
End Sub
If I try the offset function, it will merge what ever offset I select but will not merge both the original selected rows and the offset rows.
Private Sub CommandButton1_Click()
Dim StrAddr As String
Dim UserRange1 As Range
StrAddr = RefEdit1.Value
Set UserRange1 = Range(StrAddr)
UserRange1.Offset(0, 0).MergeCells = True
UserRange1.Offset(0, 1).MergeCells = True
End Sub