View Single Post
 
Old 08-18-2019, 09:57 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,975
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This does seem slower than I would expect. You could try this version using ranges but it doesn't show a significant speed improvement.
Code:
Sub Change_Value_to_Next_Cell_GOOD()
  Dim aRng As Range
  Dim sText As String
  sText = InputBox("Enter text to move cell")
  Set aRng = ActiveDocument.Range
  ActiveWindow.View = wdNormalView
  Application.ScreenUpdating = False
  With aRng.Find
    .ClearFormatting
    .Text = sText
    .Wrap = wdFindStop
    Do While .Execute
      If aRng.Information(wdWithInTable) Then
        aRng.Cells(1).Next.Range.FormattedText = aRng.FormattedText
        aRng.Delete
        aRng.MoveStart Unit:=wdCell, Count:=2
      End If
    Loop
  End With
  Application.ScreenUpdating = True
  MsgBox " You're Selection is Done in the Active Document!"
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote