Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi I have a workbook with 2 sheet's. Now i would like to make a copy off the active sheet to a new file, that is not a problem but the thing is that all the VBA code that i have on the master is not copied to the new sheet/file. How do i do this with VBA code her below is the code that i use today. ActiveSheet.Copy Fakturaname = keyvalue + "\Fakturor\" + Fakturanr ActiveWorkbook.SaveCopyAs Filename:=Fakturaname ActiveSheet.SaveAs Filename:=Fakturaname Best regards Karill -- Karill ------------------------------------------------------------------------ Karill's Profile: http://www.excelforum.com/member.php...o&userid=33357 View this thread: http://www.excelforum.com/showthread...hreadid=531889 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim s as String, bk as Workbook
Fakturaname = keyvalue + "\Fakturor\" + Fakturanr ActiveWorkbook.SaveCopyAs Fakturaname s = ActiveSheet.Name set bk = Workbooks.Open(Fakturaname) Application.DisplayAlerts = False for each sh in bk if sh.name < s then sh.Delete end if Next bk.Save -- Regards, Tom Ogilvy "Karill" wrote: Hi I have a workbook with 2 sheet's. Now i would like to make a copy off the active sheet to a new file, that is not a problem but the thing is that all the VBA code that i have on the master is not copied to the new sheet/file. How do i do this with VBA code her below is the code that i use today. ActiveSheet.Copy Fakturaname = keyvalue + "\Fakturor\" + Fakturanr ActiveWorkbook.SaveCopyAs Filename:=Fakturaname ActiveSheet.SaveAs Filename:=Fakturaname Best regards Karill -- Karill ------------------------------------------------------------------------ Karill's Profile: http://www.excelforum.com/member.php...o&userid=33357 View this thread: http://www.excelforum.com/showthread...hreadid=531889 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Many thanks for the quick reply! I did make an test with the code but do rescive an error when i run it. Run-time error '438' Object doesn't support this property or method On this row For Each Sh In bk Best regards Karil -- Karil ----------------------------------------------------------------------- Karill's Profile: http://www.excelforum.com/member.php...fo&userid=3335 View this thread: http://www.excelforum.com/showthread.php?threadid=53188 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy sheet and make new sheet active | Excel Discussion (Misc queries) | |||
VB code to copy sheet format to another sheet | Excel Discussion (Misc queries) | |||
Active Cell Copy And Paste Sheet to Sheet | New Users to Excel | |||
Copy my active sheet to a new sheet and open with an input form | Excel Programming | |||
Copy from active sheet and paste into new sheet using info from cell in active | Excel Programming |