Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-25-2016, 01:34 AM
rebmaboss rebmaboss is offline Pasting table data so that it will wrap around the table Windows 10 Pasting table data so that it will wrap around the table Office 2013
Novice
Pasting table data so that it will wrap around the table
 
Join Date: Nov 2016
Posts: 1
rebmaboss is on a distinguished road
Default Pasting table data so that it will wrap around the table

Let's say I have a 3x4 table with this data:




I'd like to select the first three cells, and then quickly past them onto the table so that the table will look like this:



And not like this:






Can I do that without macros? Thank you very much!
Attached Images
File Type: png Untitled1.png (1.5 KB, 21 views)
File Type: png Untitled2.png (2.8 KB, 20 views)
File Type: png Untitled3.png (2.7 KB, 20 views)
Reply With Quote
  #2  
Old 11-25-2016, 02:30 AM
gmayor's Avatar
gmayor gmayor is offline Pasting table data so that it will wrap around the table Windows 10 Pasting table data so that it will wrap around the table Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

It can't be done without macros. It can be done with a macro, based on your example. However there can be no split or merged cells and the selection must be contiguous.

Code:
Sub PasteContinuous()
'Graham Mayor - http://www.gmayor.com - Last updated - 25/11/2016
Dim oRng As Range, oRng1 As Range, oRng2 As Range
Dim Coll As New Collection
Dim oCell As Cell
Dim i As Long
    If Selection.Information(wdWithInTable) Then
        Set oRng = Selection.Range
        For Each oCell In oRng.Cells
            Set oRng1 = oCell.Range
            oRng1.End = oRng1.End - 1
            Coll.Add oRng1.Text
        Next oCell
        Set oCell = oRng.Next.Cells(1)
        Do
            On Error GoTo lbl_Exit
            For i = 1 To Coll.Count
                Set oRng2 = oCell.Range
                oRng2.End = oRng2.End - 1
                oRng2.Text = Coll(i)
                Set oRng2 = oRng2.Cells(1).Range
                Set oCell = oCell.Next
            Next i
        Loop
    End If
lbl_Exit:
    Set oCell = Nothing
    Set oRng = Nothing
    Set oRng1 = Nothing
    Set oRng2 = Nothing
    Set Coll = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pasting table data so that it will wrap around the table Importing Data from Excel - Format of table messed up in Word Table epsulliv Word Tables 6 08-24-2015 07:29 AM
Table of Contents - Wrap-around on long heading looks awful Dr Wu Word 3 07-17-2013 10:25 AM
Pasting table data so that it will wrap around the table Cells no longer wrap text when changed in nested table erik2000 Word Tables 1 03-29-2013 03:27 PM
Pasting table data so that it will wrap around the table Wrap text in table andrei Word Tables 7 10-31-2011 05:37 AM
Pasting table in Photoshop cutting off table azdolfan Word Tables 0 05-16-2010 01:52 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:07 PM.


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