Hello: I am new here and also a new Excel MAcro creator. I was trying to create annew file and them copy a row from another file to the new file, but it does not work. It worked individually, but not combined. Please help me.
Sub Test1()
Const strPath As String = "E:\TPE-10\MPO-Database\Nazrul\"
Dim strFileName As String
Dim wbNew As Workbook
strFileName = InputBox("Please enter file name", "Create new file")
If strFileName = vbNullString Then Exit Sub
Set wbNew = Workbooks.Add
wbNew.SaveAs Filename:=(strPath & strFileName), FileFormat:=xlNormal
' This command will copy A1:AA1 cells from UZA-MPO worksheet to Sheet3 at A3:AA3 location
' Workbooks("Macro-test.xlsm").Worksheets("UZA-MPO").Range("A1:AA1").Copy Worksheets("Sheet3").Range("A3:AA3")
' The following lines will also do the same thing
Workbooks("Macro-test.xlsm").Worksheets("UZA-MPO").Range("A1:AA1").Select
Selection.Copy
Workbooks("Nazrul.xls").Worksheets("Sheet1").Activate
Range("A6:AA6").Select
ActiveSheet.Paste
' Worksheet
' This command will clear cells C2:C12 in UZA-MPO worksheet
End Sub
Bookmarks