Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Jo Gjessing Jo Gjessing is offline
external usenet poster
 
Posts: 7
Default Copy text automatically from one cell in a table to another one

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
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jo Gjessing Jo Gjessing is offline
external usenet poster
 
Posts: 7
Default Copy text automatically from one cell in a table to another one

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

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Copy text automatically from one cell in a table to another one

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



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Jo Gjessing Jo Gjessing is offline
external usenet poster
 
Posts: 7
Default Copy text automatically from one cell in a table to another one

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
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can one automatically shrink text to fit within a fixed-size table cell, text box or frame? Karen New Users 7 May 9th 23 02:51 AM
How to copy table cell shading to another cell in Word? owyheerover Tables 8 May 1st 23 08:51 PM
Copy text from word document to cell of a table [email protected] Tables 1 October 3rd 05 04:19 AM
How do I copy cell data automatically Nev Page Layout 2 February 14th 05 01:07 PM
How do I auto copy data from cell in a word table to another cell. Nev New Users 1 February 4th 05 08:51 PM


All times are GMT +1. The time now is 12:44 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"