![]() |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
![]()
I have this table
![]() What I have done is recorde macro and it look like this. Selection.MoveRight Unit:=wdCell Selection.EndKey Unit:=wdLine Selection.TypeText Text:="@" Selection.MoveRight Unit:=wdCell Selection.Copy Selection.MoveLeft Unit:=wdCell Selection.ConvertToTable Separator:=wdSeparateByCommas, NumColumns:=1, _ NumRows:=9, AutoFitBehavior:=wdAutoFitFixed With Selection.Tables(1) .Style = "Table Grid" .ApplyStyleHeadingRows = True .ApplyStyleLastRow = False .ApplyStyleFirstColumn = True .ApplyStyleLastColumn = False End With Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Selection.Cut Selection.MoveLeft Unit:=wdCell Selection.EndKey Unit:=wdLine Selection.TypeParagraph Selection.PasteAndFormat (wdFormatPlainText) Selection.TypeBackspace Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.InsertRowsBelow 1 Selection.MoveUp Unit:=wdLine, Count:=29 Selection.PasteAndFormat (wdTableOverwriteCells) Selection.MoveRight Unit:=wdCell Selection.MoveDown Unit:=wdLine, Count:=29 Selection.MoveRight Unit:=wdCell Selection.MoveRight Unit:=wdCell My question is is there a short method to count the comma separated number of entries and then add that number of new row and then paste the data accordingly. what I currently do is add some 3O row and then paste the data using paste special merge the entry and then removing the empty row using macro. |
Tags |
macro vba word, microsoft word 2010, word table |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
daffy | Word VBA | 6 | 07-08-2014 05:42 PM |
Creating a table for a variable number of rows | OllieOnline | Mail Merge | 1 | 03-27-2013 02:48 PM |
Using macro to add variable number of rows to a protected word table | Julia | Word Tables | 1 | 01-09-2013 06:04 AM |
Moving data from multiple rows to 1 row for each program number | ballj_35 | Excel | 3 | 08-01-2012 05:10 AM |
![]() |
burnsie | Word | 2 | 07-12-2011 02:59 AM |