PC Review


Reply
Thread Tools Rate Thread

Appending sheet

 
 
kirkm
Guest
Posts: n/a
 
      8th Sep 2008

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
 
Reply With Quote
 
 
 
 
imageswords.br@gmail.com
Guest
Posts: n/a
 
      8th Sep 2008
On Sep 8, 12:53*pm, kirkm <x...@xx.com> 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
 
Reply With Quote
 
kirkm
Guest
Posts: n/a
 
      8th Sep 2008

Thanks Bernie,

It looks most ominous but I'll give it a try
Just one thing -

>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")


The "A1" bit (I presume) is the start point and I'd change this to
whatever new start point (Top left) I want to use ?

It needs no End co-ordinate?

Tahnks - Kirk

>'This bit actually does the copy.
>RangeToBeCopied.Copy RangeToCopyTo
>
>
>End Sub
>
>regards
>Bernie

 
Reply With Quote
 
imageswords.br@gmail.com
Guest
Posts: n/a
 
      9th Sep 2008
On Sep 8, 9:19*pm, kirkm <x...@xx.com> wrote:
> Thanks Bernie,
>
> It looks most ominous but I'll give it a try
> Just one thing -
>
> >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")

>
> The "A1" bit (I presume) is the start point and I'd change this to
> whatever new start point (Top left) I want to use ?
>
> It needs no End co-ordinate?
>
> Tahnks - Kirk
>
>
>
> >'This bit actually does the copy.
> >RangeToBeCopied.Copy RangeToCopyTo

>
> >End Sub

>
> >regards
> >Bernie- Hide quoted text -

>
> - Show quoted text -


It wont look so ominous when its in the VBE (the place where you
put code). Just copy the code from the line "Sub CopyFromOtherBook()"
to "End Sub" and place it in a module within the VBE.
Yes change the start co-ordinate to what ever you want. You dont need
an end co-ordinate, but thats a good question.
Bernie
 
Reply With Quote
 
kirkm
Guest
Posts: n/a
 
      9th Sep 2008
On Mon, 8 Sep 2008 16:28:21 -0700 (PDT), (E-Mail Removed)
wrote:

Thanks Bernie, that worked a treat. Brilliant!

Cheers - Kirk
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Appending individual XML files to a sheet XML Dan Microsoft Excel Misc 0 31st Mar 2008 02:05 AM
Appending Data from one sheet to a master sheet =?Utf-8?B?Z3VzdG83OQ==?= Microsoft Excel Programming 1 7th May 2005 03:59 PM
appending to second worksheet from a Master Sheet Driver Microsoft Excel Programming 1 19th Nov 2003 03:04 AM
Appending data from one sheet to another. Simon Microsoft Excel Programming 3 13th Nov 2003 07:32 AM
appending to existing excel sheet? scott Microsoft Access Queries 3 5th Sep 2003 02:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:00 PM.