Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
add sheets
hello their, um using vb2005 and have a tricky question
hope im on the right place im trying to fill an excel file with data, i have a model file, and then i want to fill the model and save it as another file, but i wanted to make it with a for cycle. the point is to make for example 5 times, grab the model sheet from the model file, add it 5 times to the new file and fill it with data the final result of that its 5 sheets all with the same formating with diferrent data and do not mix with the model file this is the code that i have: Dim oExcel As Excel.Application Dim oBooks As Excel.Workbooks Dim oBook As Excel.Workbook Dim oSheet As Excel.Worksheet oExcel = CreateObject("Excel.Application") oBooks = oExcel.Workbooks oBook = oBooks.Add(My.Application.Info.DirectoryPath & "\ModeloRelatorio.xls") Dim n As Integer For n = 1 To Ds1._Empregados.Rows.Count - 1 oSheet = oBook.Sheets(1).copy(1, 1) next with a diferent code i can add it 5 times but not it doesnt make the copy from that 5 sheet of the model sheet hope you can understand my problem and give me the soluiton |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA | Excel Worksheet Functions | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Worksheet Functions | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Programming | |||
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? | Excel Programming | |||
Allocate Files to Sheets and Build a Master Sheet which Summarises All Sheets | Excel Programming |