How to copy row and paste

S

Supriya

Hi all,
I have one row with some text. I want to copy and paste this(including
text ). Is it posible? Atleast can I copy cell?
Please help me.
Thanks
supriya
 
J

Jean-Guy Marcil

Supriya was telling us:
Supriya nous racontait que :
Hi all,
I have one row with some text. I want to copy and paste
this(including text ). Is it posible? Atleast can I copy cell?
Please help me.
Thanks
supriya

Sawat Dee Krap (???)

We need more information. I guess you want to copy the currently selected
row, but where do you want to paste it?
Right under the same row, at the end of the table, in another table?

Here are two examples. The first one pastes the row at the end of the same
table and the second one pastes the row right under the currently selected
row.

'_______________________________________
Option Explicit
'_______________________________________
Sub PasteRowEnd()

Dim rowCopy As Row
Dim rgeTable As Range

If Not Selection.Information(wdWithInTable) Then
MsgBox "Place the cursor in a table please."
Exit Sub
End If

Set rowCopy = Selection.Range.Rows(1)
Set rgeTable = Selection.Tables(1).Range

rowCopy.Range.Copy
With rgeTable
.Collapse wdCollapseEnd
.PasteAppendTable
End With

End Sub
'_______________________________________

'_______________________________________
Sub PasteRowUnder()

Dim rowCopy As Row

If Not Selection.Information(wdWithInTable) Then
MsgBox "Place the cursor in a table please."
Exit Sub
End If

Set rowCopy = Selection.Range.Rows(1)

With rowCopy.Range
.Copy
.Collapse wdCollapseStart
.PasteAppendTable
End With

End Sub
'_______________________________________
--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
D

digbydog

Hi,

I was after something just like this - thanks you very much - works like a
charm.

cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top