View Single Post
 
Old 03-16-2017, 11:03 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

When working with cell ranges, be aware that the cell range includes the cell end character. You are more likely to get the results you are seeking if having set the range, you remove the end character from the range (whether copying or pasting) e.g.
Code:
Set rng_Paste = UserDoc.Tables(i).Cell(MyCell.RowIndex, 1).Range
rng_Paste.End = rng_Paste.End - 1
Note also that there is no need to copy and paste when working with ranges. You can simply write the formatted value of the source range to the target range e.g.
TargetRangeName.FormattedText = SourceRangeName.FormattedText.
Your last example code does not work with two documents and their corresponding tables.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote