Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi if i run this macro,he copies the 2 spreadsheets as i want, but i
want the 2 copied sheets in the same workbook!! can i do this??? If ActiveWorkbook.Worksheets("sheet1").Range("A1") = ActiveWorkbook.Worksheets("sheet2").Range("A1") Then ActiveWorkbook.Worksheets("sheet1").Copy Cells.Copy Cells.PasteSpecial xlPasteValues Cells(1).Select Application.CutCopyMode = False ActiveWorkbook.Worksheets("sheet2").Copy Cells.Copy Cells.PasteSpecial xlPasteValues Cells(1).Select Application.CutCopyMode = False End If End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If ActiveWorkbook.Worksheets("sheet1"). _
Range("A1") = ActiveWorkbook.Worksheets( _ "sheet2").Range("A1") Then ActiveWorkbook.Worksheets("sheet1").Copy _ After:=Worksheets(Worksheets.count) Cells.Copy Cells.PasteSpecial xlPasteValues Cells(1).Select Application.CutCopyMode = False ActiveWorkbook.Worksheets("sheet2").Copy _ After:=Worksheets(Worksheets.count) Cells.Copy Cells.PasteSpecial xlPasteValues Cells(1).Select Application.CutCopyMode = False End If -- Regards, Tom Ogilvy "matthias" wrote in message oups.com... hi if i run this macro,he copies the 2 spreadsheets as i want, but i want the 2 copied sheets in the same workbook!! can i do this??? If ActiveWorkbook.Worksheets("sheet1").Range("A1") = ActiveWorkbook.Worksheets("sheet2").Range("A1") Then ActiveWorkbook.Worksheets("sheet1").Copy Cells.Copy Cells.PasteSpecial xlPasteValues Cells(1).Select Application.CutCopyMode = False ActiveWorkbook.Worksheets("sheet2").Copy Cells.Copy Cells.PasteSpecial xlPasteValues Cells(1).Select Application.CutCopyMode = False End If End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
the macro works perfectly!!! but now he copies the worksheets in the same workbook. I want to copy the sheets in an existing workbook (for instance: c:\book1.xls\sheet1 for sheets 1 and so on) is this possible?? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Isn't that what you asked for?
i want the 2 copied sheets in the same workbook!! If this is another question then I gues you are asking to copy to another existing workbook. I assume the workbook you want to copy to is Book1.xls located in "C:\" If it isn't open, then open it. Dim s as String, s1 as String Dim bk as Workbook, bk1 as Workbook s = "Book1.xls" s1 = "C:\" & s set bk1 = Activeworkbook On Error Resume next set bk = Workbooks(s) On errror goto 0 if bk is nothing then set bk = Workbooks.Open(s1) end if If bk1.Worksheets("sheet1"). _ Range("A1") = bk1.Worksheets( _ "sheet2").Range("A1") Then bk1.Worksheets("sheet1").Copy _ After:=bk.Worksheets(bk.Worksheets.count) Cells.Copy Cells.PasteSpecial xlPasteValues Cells(1).Select Application.CutCopyMode = False bk1.Worksheets("sheet2").Copy _ After:=bk.Worksheets(bk.Worksheets.count) Cells.Copy Cells.PasteSpecial xlPasteValues Cells(1).Select Application.CutCopyMode = False End If -- Regards, Tom Ogilvy "matthias" wrote in message oups.com... Hello, the macro works perfectly!!! but now he copies the worksheets in the same workbook. I want to copy the sheets in an existing workbook (for instance: c:\book1.xls\sheet1 for sheets 1 and so on) is this possible?? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks it is perfect!!!!!
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to copy a spreadsheet in shared workbook | Excel Worksheet Functions | |||
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook | Excel Worksheet Functions | |||
Macro to copy and append spreadsheet changes to new spreadsheet | Excel Discussion (Misc queries) | |||
please help, need to copy row to separate spreadsheet in workbook | Excel Worksheet Functions | |||
Copy sheet from one workbook to another workbook problem | Excel Programming |