Thread: Appending sheet
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] imageswords.br@gmail.com is offline
external usenet poster
 
Posts: 14
Default Appending sheet

On Sep 8, 12:53*pm, kirkm wrote:
Is there a method, either VB or direct mode, to append one sheet to
an existing one, including all formatting - particularly font colour
and the embedded *comments and comment shape/size ?

They're currently in separate xls. files.

Thanks - Kirk


Hi Kirk,
try the following as a start. You may need to adapt it to your needs.
Such as what range you want to copy and where you want to copy to and
checking if files are open etc...

Sub CopyFromOtherBook()
'This procedure requires the workbooks to be open.
'It is possible to open them programmatically, but that is a different
story


Dim RangeToBeCopied As Range
Dim RangeToCopyTo As Range
'This line sets the range that you want to copy, I have used
the .UsedRange property which
'returns a rectangular shaped range that intersects the right-most,
left-most, top-most and bottom-most cells
' Ie. the used range...hehe
Set RangeToBeCopied =
Application.Workbooks("Book1").Worksheets("Sheet1" ).UsedRange
'This line sets the destination to which you wish to paste. This is
the Top-Left.
Set RangeToCopyTo =
Application.Workbooks("Book2").Worksheets("Sheet1" ).Range("A1")
'This bit actually does the copy.
RangeToBeCopied.Copy RangeToCopyTo


End Sub

regards
Bernie