VBA MERGE CELLS DURING PROCEDURE I WOULD LIKE TO HAVE CELLS H-L MERGE ON CURRENT
ID: 638386 • Letter: V
Question
VBA MERGE CELLS DURING PROCEDURE
I WOULD LIKE TO HAVE CELLS H-L MERGE ON CURRENT ROW AT STEP BELOW BUT CAN'T GET IT TO WORK
'COPY COMMENTS AND CELL NAME TO THE BOTTOM OF THE SHEET.
Sub ShowComments()
Application.ScreenUpdating = False
Dim commrange As Range
Dim mycell As Range
Dim curwks As Worksheet
Dim i As Long
Set curwks = ActiveSheet
On Error Resume Next
Set commrange = curwks.Cells _
.SpecialCells(xlCellTypeComments)
On Error GoTo 0
If commrange Is Nothing Then
MsgBox "no comments found"
Exit Sub
End If
curwks.Range("A270").Value = _
Array("WORKSHEET NAME") 'Title for section
i = 270 'row to start adding comments/name. if adding rows, be sure to change this
For Each mycell In commrange
With curwks
i = i + 1
On Error Resume Next
.Cells(i, 7).Value = mycell.Name.Name 'adds cell name in column G
.Cells(i, 8).Value = mycell.Comment.Text 'adds cell comments in column H
I WOULD LIKE TO HAVE CELLS H-L MERGE ON CURRENT ROW AT THIS POINT, BUT CAN'T GET ANYTHING TO WORK- ANY IDEAS?
End With
Next mycell
End Sub.
Thanks for help !!
Explanation / Answer
Hi..
Add this line at the appropriate point in your code....
.Cells(i, 8).Resize(, 5).MergeCells = True.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.