ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy (https://www.excelbanter.com/excel-discussion-misc-queries/44894-copy.html)

Michael

Copy
 
Hi...

I have a small problem but still need some help.

I have a workbook called "Sumary.xls" located in a folder

Dim strPath As String
Dim strParent As String
Dim pos As Long
Dim Slutt As String

strPath = ActiveWorkbook.Path

**** Then i have to open another workbook called "Statistikk.xls"

pos = InStrRev(strPath, "\")

strParent = Left(strPath, pos - 1)

Slutt = strParent & "\VT" & "\VT" & "\Arkiv\" & "Statistikk.xls"

Workbooks.Open Slutt

***Everything is ok with this, but:

***** Then i want to copy the sheet "stat" in the "Statistikk.xls" workbook

Workbooks("Statistikk.xls").Worksheets("stat").Cop y

****And paste it to a sheet called "VT" in the "sumary" workbook.

ThisWorkbook.Worksheets("VT").Paste =
Workbooks("Statistikk.xls").Worksheets("stat")


But this doesnt work, please help!

Mike
--
Nil Satis Nisi Optimum

R.VENKATARAMAN

try something likethis

Public Sub test()
Sheet1.UsedRange.Copy
Sheet2.Range("a1").PasteSpecial
Application.CutCopyMode = False
End Sub
======================
"Michael" wrote in message
...
Hi...

I have a small problem but still need some help.

I have a workbook called "Sumary.xls" located in a folder

Dim strPath As String
Dim strParent As String
Dim pos As Long
Dim Slutt As String

strPath = ActiveWorkbook.Path

**** Then i have to open another workbook called "Statistikk.xls"

pos = InStrRev(strPath, "\")

strParent = Left(strPath, pos - 1)

Slutt = strParent & "\VT" & "\VT" & "\Arkiv\" & "Statistikk.xls"

Workbooks.Open Slutt

***Everything is ok with this, but:

***** Then i want to copy the sheet "stat" in the "Statistikk.xls"

workbook

Workbooks("Statistikk.xls").Worksheets("stat").Cop y

****And paste it to a sheet called "VT" in the "sumary" workbook.

ThisWorkbook.Worksheets("VT").Paste =
Workbooks("Statistikk.xls").Worksheets("stat")


But this doesnt work, please help!

Mike
--
Nil Satis Nisi Optimum




Michael

PERFECT!!

Thank's R.VENKATARAMAN

Mike
--
Nil Satis Nisi Optimum


"R.VENKATARAMAN" wrote:

try something likethis

Public Sub test()
Sheet1.UsedRange.Copy
Sheet2.Range("a1").PasteSpecial
Application.CutCopyMode = False
End Sub
======================
"Michael" wrote in message
...
Hi...

I have a small problem but still need some help.

I have a workbook called "Sumary.xls" located in a folder

Dim strPath As String
Dim strParent As String
Dim pos As Long
Dim Slutt As String

strPath = ActiveWorkbook.Path

**** Then i have to open another workbook called "Statistikk.xls"

pos = InStrRev(strPath, "\")

strParent = Left(strPath, pos - 1)

Slutt = strParent & "\VT" & "\VT" & "\Arkiv\" & "Statistikk.xls"

Workbooks.Open Slutt

***Everything is ok with this, but:

***** Then i want to copy the sheet "stat" in the "Statistikk.xls"

workbook

Workbooks("Statistikk.xls").Worksheets("stat").Cop y

****And paste it to a sheet called "VT" in the "sumary" workbook.

ThisWorkbook.Worksheets("VT").Paste =
Workbooks("Statistikk.xls").Worksheets("stat")


But this doesnt work, please help!

Mike
--
Nil Satis Nisi Optimum






All times are GMT +1. The time now is 02:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com