View Full Version : Copy and Paste Table Row above Bookmarked Row
Loss1003
04-09-2015, 09:28 AM
Copy and Paste Table Row above Bookmarked Row
Private Sub CommandButton2_Click()
ActiveDocument.Bookmarks("LCVenSect").Range.Select
Selection.Copy
ActiveDocument.Bookmarks("LCRemSect").Range.Select
I need help finishing the above code. I'd like to copy the bookmarked LCVenSect Row and then insert it above the bookmarked LCRemSect row.
Thank you.
gmayor
04-09-2015, 10:04 PM
You are overthinking this :)
Dim oRow As Row
Set oRow = ActiveDocument.Bookmarks("LCVenSect").Range.Rows(1)
oRow.Range.Copy
oRow.Range.Paste
Loss1003
04-10-2015, 06:40 AM
Thanks for your help Mucho appreciated.:hi:
I did get a run-time error when I tried adding the row.
I've attached the document I'm working on to help visualize the end goal.
Basically every time a user clicks the Add requestor section button. I want the heading row (Date and *Comment and Note Section*) to be copied and pasted above the Loss Control Remarks Section.
Loss1003
04-10-2015, 06:43 AM
I noticed one error on my part the LCVenSect should read VendComSect. However I still need the line to be pasted above the LCRemSect
gmayor
04-10-2015, 07:38 AM
In that case you need
Dim oRow As Row
Set oRow = ActiveDocument.Bookmarks("VendComSect").Range.Rows(1)
oRow.Range.Copy
Set oRow = ActiveDocument.Bookmarks("LCRemSect").Range.Rows(1)
oRow.Range.Paste
Set oRow = Nothing
Loss1003
04-10-2015, 07:54 AM
Excellent and thank you.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.