PDA

View Full Version : Can you help me?I want code



ryanwangcn
05-08-2008, 08:55 AM
Hello,can you help me,I want code that can do that,I create mother Excel,then open other excel,read value that i need,then write the value in mother Excel,then save new file,I need code can reply do it ,more and more,Thanks!

Simon Lloyd
05-08-2008, 09:06 AM
Perhaps something like:
Sub Copy_Data()
Dim oBook As String
oBook = ThisWorkbook.Name
Workbooks.Open ("C:\MyWorkbook.xls")
Sheets("Sheet1").Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).Copy
Workbooks(oBook).Activate
Sheets("Sheet1").Activate
With Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
ActiveSheet.Paste
End With
Workbooks("MyWorkbook").Close False
ThisWorkbook.SaveAs (ThisWorkbook.Name & " - " & Format(Date, "dd-mm-yyyy"))
End Sub

ryanwangcn
05-09-2008, 02:35 AM
Thank you very much