Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That sounds like you throw away the previous data and start anew each day.
The new log file replaces the existing sheet 2 in your excel file. I'm not sure what the name of the sheet2 is, but you could delete it first: application.displayalerts = false Workbooks("Import ProE Log.xls").Sheets("sheet2").delete application.displayalerts = true Then MOVE that imported worksheet to where you want it: Activesheet.Move _ Befo=Workbooks("Import ProE Log.xls").Sheets(1) activesheet.name = "Sheet2" Right after you open that .csv file, it's the activesheet. And it'll still be active when it hits the "import Proe log.xls" workbook. Then.. With worksheets("sheet2") .range("a1").resize(2,1).entirerow.insert 'to make room for the headers end with =================== Another option (if you aren't too confused already). Just copy that used range to the existing worksheet starting in A3. 'clear out old data Workbooks("Import ProE Log.xls").Sheets("sheet2").range("A3:IV65536").cle ar Workbooks.OpenText Filename:= ..... activesheet.usedrange.copy _ destination:=Workbooks("Import ProE Log.xls").Sheets("sheet2").range("a3") '''' and the headers won't need to be added. ============ Try changing mudraker's .paste line to: .PasteSpecial xlValues or Rows("1:" & GetBottomRow).Copy _ destination:=Workbooks("Import ProE Log.xls").Sheets(1).Range("a3") (Yeah, there's lots of ways to skin that cat!) Good luck, "morry <" wrote: Thank you for the code mudraker but when I ran it it gave me and error (object doesn't support this method) in the line listed below. I tried to figure it out but I couldn't get anything else to work. Do you know whats wrong? Workbooks("Import ProE Log.xls").Sheets(2).Range("a3").Paste Dave - to clarify my objectives: I have a csv log file that gets updated everyday. I also have a Excel workbook called "Import ProE Log" I want to copy the data from the log file, delimit it, and open it as sheet two in my workbook. I need the data two start on row three so I can insert headers on the first rows. I have my code in a command button so that this can be run every day. Sorry it wasn't clear the first time. Thank you both for your help morry --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying a range of data without adjusting formulas | Excel Discussion (Misc queries) | |||
calculate values in an unlimited range of cells in a column WITHOUTalso calculating values that had previously been filtered AGAINST? | Excel Discussion (Misc queries) | |||
Copying data from multiple file into one file | Excel Discussion (Misc queries) | |||
Copying a Range of Cells having data only | Excel Worksheet Functions | |||
Copying range format and formulae without data | Excel Discussion (Misc queries) |