A
active_x
what's wrong?
Example:
------------------------------------------------------------------------------------Sub
combine_cells()
Dim rngContent As Range
Dim rLastContent As Integer
Dim i As Integer
rLastContent = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
Set rngContent = Range("B4:G" & rLastContent)
Application.DisplayAlerts = False
For i = 4 To rLastContent
Range("B"&i&":"&"G"&i).Merge
Next
Application.DisplayAlerts = True
End Sub
------------------------------------------------------------------------------------The
above vba is supposed to run in this way:
merge B4:G4
merge B5:G5
merge B6:G6
...
However, NONE of the cells is merged! What's wrong? (question 1)
Can the vba be written in the form of: (question 2)
For Each ... In ...
...
Next
If yes, how to write? (question 3)
Example:
------------------------------------------------------------------------------------Sub
combine_cells()
Dim rngContent As Range
Dim rLastContent As Integer
Dim i As Integer
rLastContent = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
Set rngContent = Range("B4:G" & rLastContent)
Application.DisplayAlerts = False
For i = 4 To rLastContent
Range("B"&i&":"&"G"&i).Merge
Next
Application.DisplayAlerts = True
End Sub
------------------------------------------------------------------------------------The
above vba is supposed to run in this way:
merge B4:G4
merge B5:G5
merge B6:G6
...
However, NONE of the cells is merged! What's wrong? (question 1)
Can the vba be written in the form of: (question 2)
For Each ... In ...
...
Next
If yes, how to write? (question 3)