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