Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 02-16-2021, 11:36 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Need help, get error message when place tbl.... Windows 10 Need help, get error message when place tbl.... Office 2019
Competent Performer
Need help, get error message when place tbl....
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Default

I had to fix something, sorry for the delay

Code:
Sub T1fr_Merge_2Col_Vertically_in_1_col_TST()
'This macro is to have every row in each column, under each other, as 1 column

Application.ScreenUpdating = False

' Select column l, then go to Column 2
    Selection.SelectColumn
    Selection.MoveRight Unit:=wdCell
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCell
    Selection.EndKey Unit:=wdRow, Extend:=True
    Selection.EndKey Unit:=wdColumn, Extend:=True

'Select column 2, Cut then paste below table 1
    Selection.Copy
    Selection.Cut
    Selection.EndKey Unit:=wdColumn, Extend:=True
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.PasteAndFormat (wdFormatOriginalFormatting)
    Selection.MoveUp Unit:=wdLine, Count:=1
    Selection.HomeKey Unit:=wdRow, Extend:=True
    Selection.HomeKey Unit:=wdColumn, Extend:=True
    Selection.MoveRight Unit:=wdCell
    Selection.MoveRight Unit:=wdCell
    Selection.EndKey Unit:=wdRow, Extend:=True
    Selection.EndKey Unit:=wdColumn, Extend:=True

'  Remove extra paragraph marks to get all tables as 1
    Selection.MoveUp Unit:=wdLine, Count:=1
    Selection.HomeKey Unit:=wdColumn
    Selection.MoveUp Unit:=wdLine, Count:=1
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.MoveUp Unit:=wdLine, Count:=1
    Selection.Delete Unit:=wdCharacter, Count:=1
    
'Resize the whole table as 1 column, page wide
    Selection.Tables(1).Select
    Selection.Rows.ConvertToText Separator:=wdSeparateByParagraphs, _
        NestedTables:=False
    Selection.ConvertToTable Separator:=wdSeparateByParagraphs, NumColumns:=1, _
         NumRows:=31, AutoFitBehavior:=wdAutoFitFixed

Application.ScreenUpdating = True
    
    On Error GoTo 0
End Sub
Reply With Quote
 

Tags
error message, pasteandformat table



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Error Message Run time Error 4605 baes10 Word VBA 1 08-30-2018 02:37 PM
Error Message PointCheck Word VBA 1 08-13-2018 02:42 PM
No known fix for this error message... Aymincendiary PowerPoint 1 09-03-2017 05:38 PM
Need help, get error message when place tbl.... Reserved error(-1517); there is no message for this error ktest Office 1 02-12-2016 08:08 PM
Need help, get error message when place tbl.... Automation error Unknown error" message once they open the Excel file hlina Excel 1 10-08-2013 09:14 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:52 PM.


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