PDA

View Full Version : Solved: Copying a range of cell values to another existing workbook



bananatang
12-19-2008, 09:24 AM
HI,

With the aid of a VB member from this forum. I have manage to get the code working for copying from a range of cells and pasting it to the last row of another worksheet in a differant workbook.

I now need to tweak the code as the data that has been copied contains references, formulas etc

Can anyone help.

The code i have is as follows:

Sub copydata()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Workbooks.Open "R:\LLC_Access_Social_Inc\Misc\General Excl Data Stats.xls"
Windows("Exclusions by Secondary School 08_09.xls").Activate
Sheet4.Visible = xlSheetVisible
Sheets("Count Usage").Select
Range("A4:F13").Copy Destination:=Workbooks("General Excl Data Stats.xls").Sheets("Rawdata") _
.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
Windows("General Excl Data Stats.xls").Activate
ActiveWorkbook.Close Savechanges:=True
'Application.ScreenUpdating = True
End Sub

Bob Phillips
12-19-2008, 10:08 AM
Sub copydata()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Workbooks.Open "R:\LLC_Access_Social_Inc\Misc\General Excl Data Stats.xls"
Windows("Exclusions by Secondary School 08_09.xls").Activate
Sheet4.Visible = xlSheetVisible
Sheets("Count Usage").Select
Range("A4:F13").Copy
Workbooks("General Excl Data Stats.xls").Sheets("Rawdata") _
.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
Windows("General Excl Data Stats.xls").Activate
ActiveWorkbook.Close Savechanges:=True
'Application.ScreenUpdating = True
End Sub

bananatang
12-19-2008, 06:00 PM
Thank you for your help.

The code works perfectly.

BT