Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub G()
- Dim strFinal$
- Dim cell As Range
- Dim rngSource As Range
- Dim rngArea As Range
- Dim rngTarget As Range
- Set Target = Selection.Cells(1, 1)
- Set Start = 2
- for i = 2
- For Each rngArea In rngSource
- For Each cell In rngArea
- strFinal = strFinal & cell.Value & " "
- cell.Value = ""
- cell.Delete
- Next
- Next
- strFinal = Left$(strFinal, Len(strFinal) - 1)
- rngTarget.Value = strFinal
- End Sub
- Sub Test()
- Debug.Print (Selection.Rows.Count)
- End Sub
- Sub DeleteRow_and_Merge()
- Dim k As Integer
- For k = Selection.Rows.Count To 2 Step -1
- Selection.Cells(k - 1, 1) = Selection.Cells(k - 1, 1).Value & " " & Selection.Cells(k, 1)
- Selection.Cells(k, 1).Delete
- Next k
- End Sub
- Private Sub Workbook_Open()
- End Sub
- Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
- Application.OnKey "{F10}", "DeleteRow_and_Merge"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement