Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating Report
I am trying to create a macro that will create a report from the current open
file. i want it to create a new workbook and save it as the contents of a cell in the current workbook. Here is the very rough beginings of the macro, but i dont know how to get it to do what i want. Sub report() Workbooks.Add ChDir "C:\Documents and Settings\tim\Desktop" ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\tim\Desktop\Book1.xls", FileFormat: =xlNormal, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False Range("B4").Select ActiveCell.FormulaR1C1 = "=[Book2]Sheet1!R1C1" Range("B5").Select End Sub -- Message posted via http://www.officekb.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating Report
Sub report()
Dim bk as Workbook Dim sname as String set bk = Activeworkbook sName = Range("B9").Value if sname = "" then exit sub Workbooks.Add ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\tim\Desktop\" & _ sname & ".xls", FileFormat:=xlNormal, _ Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False Range("B4").Select ' linking formula back to the original workbook? ActiveCell.FormulaR1C1 = "=[" & _ bk.name & "]Sheet1!R1C1" Range("B5").Select End Sub -- Regards, Tom Ogilvy "brownti via OfficeKB.com" wrote: I am trying to create a macro that will create a report from the current open file. i want it to create a new workbook and save it as the contents of a cell in the current workbook. Here is the very rough beginings of the macro, but i dont know how to get it to do what i want. Sub report() Workbooks.Add ChDir "C:\Documents and Settings\tim\Desktop" ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\tim\Desktop\Book1.xls", FileFormat: =xlNormal, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False Range("B4").Select ActiveCell.FormulaR1C1 = "=[Book2]Sheet1!R1C1" Range("B5").Select End Sub -- Message posted via http://www.officekb.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating an overdue report. | New Users to Excel | |||
Creating a Report | Excel Discussion (Misc queries) | |||
creating an aging report | Excel Worksheet Functions | |||
Creating a Subset Report | Excel Worksheet Functions | |||
Creating a report by For Each... | Excel Programming |