PC Review


Reply
Thread Tools Rate Thread

Copy text automatically from one cell in a table to another one

 
 
Jo Gjessing
Guest
Posts: n/a
 
      4th Feb 2009
Hi all,

In a Word document of mine I have three tables with two cells in each. When
the user writes something in the left cell of the uppermost table I want a
VBA script, or another function, to copy the text to the left cell of the
lowermost table. Can you imagine how I do this? If you have an enlightening
comment for me, please let me know. Thank you very much in advance.

Jo
 
Reply With Quote
 
 
 
 
Jo Gjessing
Guest
Posts: n/a
 
      4th Feb 2009
Hi all,

I forgot to write that we are using Word 2003 ...

Jo

Jo Gjessing skrev:

> Hi all,
>
> In a Word document of mine I have three tables with two cells in each. When
> the user writes something in the left cell of the uppermost table I want a
> VBA script, or another function, to copy the text to the left cell of the
> lowermost table. Can you imagine how I do this? If you have an enlightening
> comment for me, please let me know. Thank you very much in advance.
>
> Jo

 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      4th Feb 2009
The following macro will copy the first cell of table 1 to the first cell of
table 3

Sub DuplicateCell1()
Dim oRng As Range
With ActiveDocument
Set oRng = .Tables(1).Cell(1, 1).Range
oRng.End = oRng.End - 1
.Tables(3).Cell(1, 1).Range.Text = oRng
End With
End Sub

http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Jo Gjessing wrote:
> Hi all,
>
> In a Word document of mine I have three tables with two cells in
> each. When the user writes something in the left cell of the
> uppermost table I want a VBA script, or another function, to copy the
> text to the left cell of the lowermost table. Can you imagine how I
> do this? If you have an enlightening comment for me, please let me
> know. Thank you very much in advance.
>
> Jo



 
Reply With Quote
 
Jo Gjessing
Guest
Posts: n/a
 
      4th Feb 2009
Hi, Graham.

Thank you for responding so quickly.

I've now inserted another table in my document so I changed

..Tables(3).Cell(1, 1).Range.Text = oRng

to

..Tables(4).Cell(1, 1).Range.Text = oRng

Also I renamed your script from Sub DuplicateCell1() to Sub
DuplicateCell1_BeforePrint () to connect it to the BeforePrint event. I'm not
able, however, to make it work. Can that be because I now have two macros
connected to the BeforePrint in the same document? Hoping to hearing from you
again.

Jo

Jo Gjessing skrev:

> Hi all,
>
> In a Word document of mine I have three tables with two cells in each. When
> the user writes something in the left cell of the uppermost table I want a
> VBA script, or another function, to copy the text to the left cell of the
> lowermost table. Can you imagine how I do this? If you have an enlightening
> comment for me, please let me know. Thank you very much in advance.
>
> Jo

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using VBA to Copy Rich Text Cell Data from Word Table to ADORecordset Field Don Microsoft Access Form Coding 0 11th Mar 2011 04:07 PM
Copy Paste Excel Text Data to Powerpoint Table Automatically Forma rslaughter5 Microsoft Powerpoint 0 28th May 2010 06:44 PM
How can I automatically copy cell contents from one cell into anot geeeberry Microsoft Excel New Users 2 6th Jul 2008 10:33 AM
Can one automatically shrink text to fit within a fixed-size table cell, text box or frame? Karen Microsoft Word New Users 5 22nd Jul 2006 02:06 PM
How to copy 9 fields data from table to other table automatically =?Utf-8?B?QWxhbjQ4?= Microsoft Access VBA Modules 8 21st Jul 2005 01:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:57 PM.