A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

macros for tables (2007)



 
 
Thread Tools Display Modes
  #1  
Old June 23rd, 2008, 09:25 PM posted to microsoft.public.word.tables
aedcone
external usenet poster
 
Posts: 26
Default macros for tables (2007)

I have table that consists of over 200 rows with text already in it. I've
added a second column. I now need to split the cells in the second colum
into two rows... This is to create a pedigree chart of sorts... I want to
create a macro to do this, but I can't seem to start the macro for
anything... Normally, I would right click in the cell, select split table,
change the column to 1, the rows to 2. This is macro I need to create, but
it won't let met right click in the cell whilst I have the "developer" tab
up, and when i go to the Insert table and select table, I don't get the menu
to split the table...

Help is needed asap... as it is, it's a big PIA to do this cell by cell...
and I thought a macro would help...

TIA
  #2  
Old June 23rd, 2008, 11:42 PM posted to microsoft.public.word.tables
StevenM[_2_]
external usenet poster
 
Posts: 170
Default macros for tables (2007)

To: Aedcone,

I'm not following you. I think if you clarified your problem, you might find
someone posting an answer faster.

For example, you stated that you had a table with over 200 rows with text in
it.
Then you added a second column. Is the second column empty or does it have
text in it too?

The you stated that you needed to split the cells in the second column and
create two rows. Yes?

Now, if I'm understanding you here, the first column has over 200 rows, so
does that mean you want the second column to have over 400 rows? So that for
each row in column one, there will be two rows in column two?

For example, do you need a table which looks something like:

Sub TableSplitRows()
Dim newDoc As Document
Dim oRange As Range
Dim oTable As Table

Set newDoc = Documents.Add
Set oRange = newDoc.Range
Set oTable = newDoc.Tables.Add(oRange, NumRows:=2, NumColumns:=2)
oTable.Columns(2).Cells(2).Split NumRows:=2
oTable.Columns(2).Cells(1).Split NumRows:=2
End Sub

Steven Craig Miller

"aedcone" wrote:

I have table that consists of over 200 rows with text already in it. I've
added a second column. I now need to split the cells in the second colum
into two rows... This is to create a pedigree chart of sorts... I want to
create a macro to do this, but I can't seem to start the macro for
anything... Normally, I would right click in the cell, select split table,
change the column to 1, the rows to 2. This is macro I need to create, but
it won't let met right click in the cell whilst I have the "developer" tab
up, and when i go to the Insert table and select table, I don't get the menu
to split the table...

Help is needed asap... as it is, it's a big PIA to do this cell by cell...
and I thought a macro would help...

TIA

  #3  
Old June 24th, 2008, 12:38 AM posted to microsoft.public.word.tables
Jules[_4_]
external usenet poster
 
Posts: 64
Default macros for tables (2007)

Nice macro Steven.

If you select your second column and hit the layout tab and select split
cells it does what you require with Developer Tab on or off.

"StevenM" stevencraigmiller(at)comcast(dot)net wrote in message
...
To: Aedcone,

I'm not following you. I think if you clarified your problem, you might
find
someone posting an answer faster.

For example, you stated that you had a table with over 200 rows with text
in
it.
Then you added a second column. Is the second column empty or does it have
text in it too?

The you stated that you needed to split the cells in the second column and
create two rows. Yes?

Now, if I'm understanding you here, the first column has over 200 rows, so
does that mean you want the second column to have over 400 rows? So that
for
each row in column one, there will be two rows in column two?

For example, do you need a table which looks something like:

Sub TableSplitRows()
Dim newDoc As Document
Dim oRange As Range
Dim oTable As Table

Set newDoc = Documents.Add
Set oRange = newDoc.Range
Set oTable = newDoc.Tables.Add(oRange, NumRows:=2, NumColumns:=2)
oTable.Columns(2).Cells(2).Split NumRows:=2
oTable.Columns(2).Cells(1).Split NumRows:=2
End Sub

Steven Craig Miller

"aedcone" wrote:

I have table that consists of over 200 rows with text already in it.
I've
added a second column. I now need to split the cells in the second colum
into two rows... This is to create a pedigree chart of sorts... I want
to
create a macro to do this, but I can't seem to start the macro for
anything... Normally, I would right click in the cell, select split
table,
change the column to 1, the rows to 2. This is macro I need to create,
but
it won't let met right click in the cell whilst I have the "developer"
tab
up, and when i go to the Insert table and select table, I don't get the
menu
to split the table...

Help is needed asap... as it is, it's a big PIA to do this cell by
cell...
and I thought a macro would help...

TIA



  #4  
Old June 24th, 2008, 02:00 AM posted to microsoft.public.word.tables
aedcone
external usenet poster
 
Posts: 26
Default macros for tables (2007)

Hi Steve,

Column 1 has text in it. (200 rows)
I added a second column (no text) (200 rows) which I need to split in two
"cells" or "rows"... the second colum w/the two rows is associated with the
first column

Sorry, but I don't understand what you wrote/ or how your wrote it. I am
new 2007 and macros in this version are way beyond what I did to create
macros in Word 2000.

Sub TableSplitRows()
Dim newDoc As Document
Dim oRange As Range
Dim oTable As Table

Set newDoc = Documents.Add
Set oRange = newDoc.Range
Set oTable = newDoc.Tables.Add(oRange, NumRows:=2, NumColumns:=2)
oTable.Columns(2).Cells(2).Split NumRows:=2
oTable.Columns(2).Cells(1).Split NumRows:=2
End Sub

Anyway, thanks for whatever the above is... I have no idea if this is what i
was looking for... What i actually did is to create a table w/400 rows and
then merged two cells in column to form one cell. It was tedious and time
consuming, but I did get the job done.

"StevenM" wrote:

To: Aedcone,

I'm not following you. I think if you clarified your problem, you might find
someone posting an answer faster.

For example, you stated that you had a table with over 200 rows with text in
it.
Then you added a second column. Is the second column empty or does it have
text in it too?

The you stated that you needed to split the cells in the second column and
create two rows. Yes?

Now, if I'm understanding you here, the first column has over 200 rows, so
does that mean you want the second column to have over 400 rows? So that for
each row in column one, there will be two rows in column two?

For example, do you need a table which looks something like:

Sub TableSplitRows()
Dim newDoc As Document
Dim oRange As Range
Dim oTable As Table

Set newDoc = Documents.Add
Set oRange = newDoc.Range
Set oTable = newDoc.Tables.Add(oRange, NumRows:=2, NumColumns:=2)
oTable.Columns(2).Cells(2).Split NumRows:=2
oTable.Columns(2).Cells(1).Split NumRows:=2
End Sub

Steven Craig Miller

"aedcone" wrote:

I have table that consists of over 200 rows with text already in it. I've
added a second column. I now need to split the cells in the second colum
into two rows... This is to create a pedigree chart of sorts... I want to
create a macro to do this, but I can't seem to start the macro for
anything... Normally, I would right click in the cell, select split table,
change the column to 1, the rows to 2. This is macro I need to create, but
it won't let met right click in the cell whilst I have the "developer" tab
up, and when i go to the Insert table and select table, I don't get the menu
to split the table...

Help is needed asap... as it is, it's a big PIA to do this cell by cell...
and I thought a macro would help...

TIA

  #5  
Old June 24th, 2008, 12:11 PM posted to microsoft.public.word.tables
StevenM[_2_]
external usenet poster
 
Posts: 170
Default macros for tables (2007)

To: Aedcone,

Well, you message appeared to ask for a macro, so I assumed that you had
some familiarity with them.

To Install a Macro:
Go to VBA editor via Tools Macro Visual Basic Editor (or Alt-F11).
Open the Project Explorer (if not open) , the shortcut key is Ctrl-R.
It will have the name “Project.”
Click on the template where you would like to store your macro.
For example click on “Normal.”
Insert a new Module with: Insert Module.
It should have the name Module1.
(You can re-name your new module now or later by clicking on F4, this should
bring up the Properties Window. In the field following “(name)” you can
change the module’s name. Close the Properties window, now the new Module
should have a new name.)
The code window should now be open.
The code window has General & Declarations at the top.
If it is not open, double click on the Module.
Cut and past your macro into the code window.
You can store more than one macro in a module.
To run your macro, go back to your document and click on Alt-F8.
Alt-F8 will bring up the macro menu from which you can pick your macro and
run it.

Steven Craig Miller

"aedcone" wrote:

Hi Steve,

Column 1 has text in it. (200 rows)
I added a second column (no text) (200 rows) which I need to split in two
"cells" or "rows"... the second colum w/the two rows is associated with the
first column

Sorry, but I don't understand what you wrote/ or how your wrote it. I am
new 2007 and macros in this version are way beyond what I did to create
macros in Word 2000.

Sub TableSplitRows()
Dim newDoc As Document
Dim oRange As Range
Dim oTable As Table

Set newDoc = Documents.Add
Set oRange = newDoc.Range
Set oTable = newDoc.Tables.Add(oRange, NumRows:=2, NumColumns:=2)
oTable.Columns(2).Cells(2).Split NumRows:=2
oTable.Columns(2).Cells(1).Split NumRows:=2
End Sub

Anyway, thanks for whatever the above is... I have no idea if this is what i
was looking for... What i actually did is to create a table w/400 rows and
then merged two cells in column to form one cell. It was tedious and time
consuming, but I did get the job done.

"StevenM" wrote:

To: Aedcone,

I'm not following you. I think if you clarified your problem, you might find
someone posting an answer faster.

For example, you stated that you had a table with over 200 rows with text in
it.
Then you added a second column. Is the second column empty or does it have
text in it too?

The you stated that you needed to split the cells in the second column and
create two rows. Yes?

Now, if I'm understanding you here, the first column has over 200 rows, so
does that mean you want the second column to have over 400 rows? So that for
each row in column one, there will be two rows in column two?

For example, do you need a table which looks something like:

Sub TableSplitRows()
Dim newDoc As Document
Dim oRange As Range
Dim oTable As Table

Set newDoc = Documents.Add
Set oRange = newDoc.Range
Set oTable = newDoc.Tables.Add(oRange, NumRows:=2, NumColumns:=2)
oTable.Columns(2).Cells(2).Split NumRows:=2
oTable.Columns(2).Cells(1).Split NumRows:=2
End Sub

Steven Craig Miller

"aedcone" wrote:

I have table that consists of over 200 rows with text already in it. I've
added a second column. I now need to split the cells in the second colum
into two rows... This is to create a pedigree chart of sorts... I want to
create a macro to do this, but I can't seem to start the macro for
anything... Normally, I would right click in the cell, select split table,
change the column to 1, the rows to 2. This is macro I need to create, but
it won't let met right click in the cell whilst I have the "developer" tab
up, and when i go to the Insert table and select table, I don't get the menu
to split the table...

Help is needed asap... as it is, it's a big PIA to do this cell by cell...
and I thought a macro would help...

TIA

  #6  
Old June 24th, 2008, 12:51 PM posted to microsoft.public.word.tables
StevenM[_2_]
external usenet poster
 
Posts: 170
Default macros for tables (2007)

Aedcone,

I realize that I'm too late and that you have already taken care of the
situation, but for future reference. I believe the following macro is what
you asked for.

'
' TableSplitRows creates a table with two columns
' Where the second column has two rows for
' every row in the first column
'
Sub TableSplitRows()
Dim newDoc As Document
Dim oRange As Range
Dim oTable As Table
Dim nIndex As Long
Dim nRows As Long
'
' Change the value of nRows to how many rows
' is needed in the first column
'
nRows = 20
'
'
Set newDoc = Documents.Add
Set oRange = newDoc.Range
Set oTable = newDoc.Tables.Add(oRange, NumRows:=nRows, NumColumns:=2)
For nIndex = nRows To 1 Step -1
oTable.Columns(2).Cells(nIndex).Split NumRows:=2
Next nIndex
End Sub

Steven Craig Miller

"aedcone" wrote:

Hi Steve,

Column 1 has text in it. (200 rows)
I added a second column (no text) (200 rows) which I need to split in two
"cells" or "rows"... the second colum w/the two rows is associated with the
first column

Sorry, but I don't understand what you wrote/ or how your wrote it. I am
new 2007 and macros in this version are way beyond what I did to create
macros in Word 2000.

Sub TableSplitRows()
Dim newDoc As Document
Dim oRange As Range
Dim oTable As Table

Set newDoc = Documents.Add
Set oRange = newDoc.Range
Set oTable = newDoc.Tables.Add(oRange, NumRows:=2, NumColumns:=2)
oTable.Columns(2).Cells(2).Split NumRows:=2
oTable.Columns(2).Cells(1).Split NumRows:=2
End Sub

Anyway, thanks for whatever the above is... I have no idea if this is what i
was looking for... What i actually did is to create a table w/400 rows and
then merged two cells in column to form one cell. It was tedious and time
consuming, but I did get the job done.

"StevenM" wrote:

To: Aedcone,

I'm not following you. I think if you clarified your problem, you might find
someone posting an answer faster.

For example, you stated that you had a table with over 200 rows with text in
it.
Then you added a second column. Is the second column empty or does it have
text in it too?

The you stated that you needed to split the cells in the second column and
create two rows. Yes?

Now, if I'm understanding you here, the first column has over 200 rows, so
does that mean you want the second column to have over 400 rows? So that for
each row in column one, there will be two rows in column two?

For example, do you need a table which looks something like:

Sub TableSplitRows()
Dim newDoc As Document
Dim oRange As Range
Dim oTable As Table

Set newDoc = Documents.Add
Set oRange = newDoc.Range
Set oTable = newDoc.Tables.Add(oRange, NumRows:=2, NumColumns:=2)
oTable.Columns(2).Cells(2).Split NumRows:=2
oTable.Columns(2).Cells(1).Split NumRows:=2
End Sub

Steven Craig Miller

"aedcone" wrote:

I have table that consists of over 200 rows with text already in it. I've
added a second column. I now need to split the cells in the second colum
into two rows... This is to create a pedigree chart of sorts... I want to
create a macro to do this, but I can't seem to start the macro for
anything... Normally, I would right click in the cell, select split table,
change the column to 1, the rows to 2. This is macro I need to create, but
it won't let met right click in the cell whilst I have the "developer" tab
up, and when i go to the Insert table and select table, I don't get the menu
to split the table...

Help is needed asap... as it is, it's a big PIA to do this cell by cell...
and I thought a macro would help...

TIA

  #7  
Old June 25th, 2008, 12:56 PM posted to microsoft.public.word.tables
Bob Buckland ?:-\)
external usenet poster
 
Posts: 5,766
Default macros for tables (2007)

Hi Aedcone,

To add a bit to Steve's reply, regarding the location of the macro tools in Word 2007

If you recorded macros in Word 2000, that ability is still available in Word 2007. You can right click the status bar at the bottom
of the Word 2007 screen and display the 'Macro Recording' option to be available to you there when you need it.

The Macro dialog that in Word 2000 was at
Tools=Macro=Macros
is, in Word 2007, located at
View=Macros=View Macros
and a 'Record Macro' button is also there.

In Word 2007 you can also turn on
'[x] Show Developer Tab in the Ribbon'
from
Office Button=Word Options=Popular (Alt, T, O)
and that tab includes buttons for the Visual Basic editor and the macro dialog.

===========
"aedcone" wrote in message ...
Hi Steve,

Column 1 has text in it. (200 rows)
I added a second column (no text) (200 rows) which I need to split in two
"cells" or "rows"... the second colum w/the two rows is associated with the
first column

Sorry, but I don't understand what you wrote/ or how your wrote it. I am
new 2007 and macros in this version are way beyond what I did to create
macros in Word 2000. [snip]
--

Bob Buckland ?:-)
MS Office System Products MVP

*Courtesy is not expensive and can pay big dividends*


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.