Copy an array of Sheets

A

Aussiegirlone

::Can someone help edit this code that I could copy an array of sheets
onto Sheet2 please::
:: ::
::Sub copy_1()::
:: Dim SourceRange As Range, DestRange As Range::
:: Dim DestSheet As Worksheet, Lr As Long::
:: ::
:: With Application::
:: .ScreenUpdating = False::
:: .EnableEvents = False::
:: End With::
:: ::
:: 'fill in the Source Sheet and range::
:: Set SourceRange = Sheets(\"Sheet1\").Range(\"A4:D12\")::
:: ::
:: 'Fill in the destination sheet and call the LastRow::
:: 'function to find the last row::
:: Set DestSheet = Sheets(\"Sheet2\")::
:: Lr = LastRow(DestSheet)::
:: ::
:: 'With the information from the LastRow function we can::
:: 'create a destination cell and copy/paste the source range::
:: Set DestRange = DestSheet.Range(\"A\" & Lr + 1)::
:: SourceRange.Copy DestRange::
:: ::
:: With Application::
:: .ScreenUpdating = True::
:: .EnableEvents = True::
:: End With::
:: ::
::End Sub::
 
S

Simon Lloyd

Aussiegirlone;413036 said:
::Can someone help edit this code that I could copy an array of sheet
onto Sheet2 please:
Code
-------------------
Sub copy_1(
Dim SourceRange As Range, DestRange As Rang
Dim DestSheet As Worksheet, Lr As Lon

With Applicatio
.ScreenUpdating = Fals
.EnableEvents = Fals
End Wit

'fill in the Source Sheet and rang
Set SourceRange = Sheets("Sheet1").Range("A4:D12"

'Fill in the destination sheet and call the LastRo
'function to find the last ro
Set DestSheet = Sheets("Sheet2"
Lr = LastRow(DestSheet

'With the information from the LastRow function we ca
'create a destination cell and copy/paste the source rang
Set DestRange = DestSheet.Range("A" & Lr + 1
SourceRange.Copy DestRang

With Applicatio
.ScreenUpdating = Tru
.EnableEvents = Tru
End Wit

End Su
-------------------
Aussiegirlone, what is it you want to do?, do you want to copy a las
line of each and every sheet to a specific sheet, or do you want to cop
the whole contents of each and every sheet to a specific sheet

--
Simon Lloy

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com
 
A

Aussiegirlone

I have managed to change this line: Set SourceRange
Sheets("Sheet1").Range("A4:D12") to this line below
Set SourceRange = Range("A:D"
LastRow(ActiveSheet)) but I only want th
last line copied please! Thank yo
 
P

Per Jessen

Hi Aussiegirlone
Try this:

Set SourceRange=Range("A" & LastRow(ActiveSheet) & ":D" & LastRow
(ActiveSheet))

Regards,
Per
 

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