I need to find a merged cell in the active sheet and copy the value to the adjacent cell.
I tried to write a macro below but this is not copying the cell value. I am getting Error 424
in the line ActiveSheet.Cells(row, col).Select
Below is my table:
A B
**Merged Cell1**
Value1
Value2
Value3
text4
text5
text6
text7
text8
**Merged Cell3**
Value1
Value2
**Merged Cell4**
text4
text5
text6
text1
**Merged Cell5**
text4
text5
**Merged Cell5**
text
Sub TestMacro5()
Dim rcount As Integer
Dim row As Integer
Dim col As Integer
Dim i As Integer
ActiveSheet.Select
col = 1
row = 1
i = 1
rcount = Application.CountA(Range("A:A"))
For i = 1 To rcount
ActiveSheet.Cells(row, col).Select
If Selection.MergeCells Then
ActiveCell.Offset(1, 5).Value = ActiveCell.Value
row = row + 1
Exit Sub
End If
Next i
End Sub