Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-02-2022, 09:29 AM
accote accote is offline Pasting the same word in front of a paragraph in multiple rows Windows 10 Pasting the same word in front of a paragraph in multiple rows Office 2021
Novice
Pasting the same word in front of a paragraph in multiple rows
 
Join Date: Sep 2022
Posts: 4
accote is on a distinguished road
Default Pasting the same word in front of a paragraph in multiple rows


I got a word document with 30+ rows that contain text, I like to paste or insert a checkbox in front of the text in every row without having to do this line by line. Is there a way to do that? I got close to 100 docs like this, and it is very time consuming to do every line one by one. Thank You very much for any help with this.
Reply With Quote
  #2  
Old 09-02-2022, 06:45 PM
macropod's Avatar
macropod macropod is offline Pasting the same word in front of a paragraph in multiple rows Windows 10 Pasting the same word in front of a paragraph in multiple rows Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

What has this to do with Word Tables? You posted in the Word Tables section.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 09-03-2022, 07:35 AM
accote accote is offline Pasting the same word in front of a paragraph in multiple rows Windows 10 Pasting the same word in front of a paragraph in multiple rows Office 2021
Novice
Pasting the same word in front of a paragraph in multiple rows
 
Join Date: Sep 2022
Posts: 4
accote is on a distinguished road
Default

This has to do with tables because I can't use the ^p replace code as there is none when the text is in a cell.

When I have a normal text line not within a table I can use the replace ^p with the checkbox, however when the text is in a table cell this does not work, as there is no paragraph code in front of the text.

Here is a picture of what I like to accomplish
https://www.dropbox.com/s/sbcvk5a0v2sw8yv/temp.JPG?dl=0
Reply With Quote
  #4  
Old 09-03-2022, 02:18 PM
macropod's Avatar
macropod macropod is offline Pasting the same word in front of a paragraph in multiple rows Windows 10 Pasting the same word in front of a paragraph in multiple rows Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Is that supposed to be an actual checkbox, or just a square?

Kindly also attach your examples directly to your posts instead of posting links to other sites. You can do this via the paperclip button on the Advanced posting screen.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 09-04-2022, 02:47 AM
accote accote is offline Pasting the same word in front of a paragraph in multiple rows Windows 10 Pasting the same word in front of a paragraph in multiple rows Office 2021
Novice
Pasting the same word in front of a paragraph in multiple rows
 
Join Date: Sep 2022
Posts: 4
accote is on a distinguished road
Default It is an actual Checkbox

It is an actual checkbox, have the word template attached. Thanks for your help.
Attached Files
File Type: docx temp.docx (28.9 KB, 5 views)
Reply With Quote
  #6  
Old 09-05-2022, 03:15 PM
macropod's Avatar
macropod macropod is offline Pasting the same word in front of a paragraph in multiple rows Windows 10 Pasting the same word in front of a paragraph in multiple rows Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Since it's not apparent whether all your tables have exactly the same structure, the following macro works on the premise that you select the starting cell in whatever table you want to update, then run the macro. The checkbox will be added to all cells below the selected one in that cell's column.
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim c As Long, i As Long, r As Long
With Selection
  If .Information(wdWithInTable) = False Then Exit Sub
  c = .Cells(1).ColumnIndex: r = .Cells(1).RowIndex
  With .Tables(1).Range
    For i = 1 To .Cells.Count
      With .Cells(i)
        If .RowIndex >= r Then
          If .ColumnIndex = c Then
            With .Range
              .InsertBefore " "
              .Collapse wdCollapseStart
              .ContentControls.Add wdContentControlCheckBox, .Duplicate
            End With
          End If
        End If
      End With
    Next
  End With
End With
Application.ScreenUpdating = True
End Sub
In your attachment, the table has a narrow row at the bottom. As coded, the macro adds a checkbox there, too, which you can delete afterwards. Again, the macro is coded this way because it's not apparent whether all your tables have exactly the same structure.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 09-06-2022, 06:43 AM
accote accote is offline Pasting the same word in front of a paragraph in multiple rows Windows 10 Pasting the same word in front of a paragraph in multiple rows Office 2021
Novice
Pasting the same word in front of a paragraph in multiple rows
 
Join Date: Sep 2022
Posts: 4
accote is on a distinguished road
Default

Thank You Paul, I will try that It would make things much faster.
Reply With Quote
Reply

Tags
insert at beginning, paste, table cell

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pasting the same word in front of a paragraph in multiple rows Pasting multiple rows in table not working as desired NDnathan Word Tables 1 04-22-2019 07:07 PM
Pasting the same word in front of a paragraph in multiple rows Problems pasting rows between two documents Kea Word Tables 1 09-24-2015 12:58 AM
Pasting the same word in front of a paragraph in multiple rows Keep box drawn in front of Video in FRONT position a_gunslinger PowerPoint 1 04-18-2013 07:54 AM
Losing rows when pasting split cells Gitley Word Tables 1 01-15-2013 07:49 AM
Word 2003 form fields and pasting multiple paragraphs. mwmoron Word 1 12-07-2012 11:06 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:38 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft