Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-04-2014, 02:22 AM
PRA007's Avatar
PRA007 PRA007 is offline How to find number of coma and then add that number of rows in word using macro? Windows 7 32bit How to find number of coma and then add that number of rows in word using macro? Office 2010 32bit
Competent Performer
How to find number of coma and then add that number of rows in word using macro?
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default How to find number of coma and then add that number of rows in word using macro?

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.
Reply With Quote
 

Tags
macro vba word, microsoft word 2010, word table

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find number of coma and then add that number of rows in word using macro? Global macro across a number of different word files 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
How to find number of coma and then add that number of rows in word using macro? Fixing number or rows in a table burnsie Word 2 07-12-2011 02:59 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:57 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