View Single Post
 
Old 03-10-2024, 05:17 AM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 293
vivka is on a distinguished road
Default

ctviggen, what exactly do you want to delete in

[00344](tab)Text I added
[00345](tab)[00345] Beginning of what was pasted in...?

Everything until or after the tab? Or maybe sth else?
If you want to delete everything until after the tab in the selected paragraphs, try this:
Code:
Sub Del_Until()
Dim rng As range, oPar As Paragraph
    
Application.ScreenUpdating = False
    Set rng = selection.range
    For Each oPar In rng.Paragraphs
        oPar.range.Select
        selection.MoveEndUntil cset:=vbTab, count:=wdBackward
        selection.Delete
    Next oPar
Application.ScreenUpdating = True
Set rng = Nothing
 End Sub
If you want to delete everything until after the tab in the 2nd paragraph of the selection, try this:
Code:
Sub Del_Until()

    selection.Paragraphs(2).range.Select
    selection.MoveEndUntil cset:=vbTab, count:=wdBackward
    selection.Delete
Set rng = Nothing
End Sub

Last edited by vivka; 03-10-2024 at 11:10 AM.
Reply With Quote