Hi guys,
In the below macro i am trying to copy the contents of one file to another file.Here i am trying to refer to the sheet and the column through input box and also the destination cells/column using input box.But getting error at referring destination cell.Can any one of you help me in this?
Thanking you in advance,
Dee
Sub Macro1()
Flatfilename = Application.GetOpenFilename(FileFilter:="Excel files (*.xls), *.xls", Title:="Please choose a file")
Filewithmacro = ThisWorkbook.Name
'thisworkbook is current book
'ftwbook is source file
Set ftwbook = Workbooks.Open(Filename:=Flatfilename, ReadOnly:=yes)
Set thiswbook = Workbooks(Filewithmacro)
Source = InputBox("Sheet name")
Set rngfind = Application.InputBox _
(Prompt:="Select the Range", Title:="Range Selecteren", Type:=8)
With rngfind
End With
Selection.Copy
thiswbook.Worksheets("DFMA MAKE").Activate
'ActiveWindow.ScrollWorkbookTabs Position:=xlLast
'Sheets.Add After:=Sheets(Sheets.Count)
'Range("E1").Select
'cell = Application.InputBox("select the cell", Title:="cell", Type:=8).Select
'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Paste Destination:=Range("E2")
ftwbook.Activate
ActiveWindow.Close
End Sub
In the below macro i am trying to copy the contents of one file to another file.Here i am trying to refer to the sheet and the column through input box and also the destination cells/column using input box.But getting error at referring destination cell.Can any one of you help me in this?
Thanking you in advance,
Dee
Sub Macro1()
Flatfilename = Application.GetOpenFilename(FileFilter:="Excel files (*.xls), *.xls", Title:="Please choose a file")
Filewithmacro = ThisWorkbook.Name
'thisworkbook is current book
'ftwbook is source file
Set ftwbook = Workbooks.Open(Filename:=Flatfilename, ReadOnly:=yes)
Set thiswbook = Workbooks(Filewithmacro)
Source = InputBox("Sheet name")
Set rngfind = Application.InputBox _
(Prompt:="Select the Range", Title:="Range Selecteren", Type:=8)
With rngfind
End With
Selection.Copy
thiswbook.Worksheets("DFMA MAKE").Activate
'ActiveWindow.ScrollWorkbookTabs Position:=xlLast
'Sheets.Add After:=Sheets(Sheets.Count)
'Range("E1").Select
'cell = Application.InputBox("select the cell", Title:="cell", Type:=8).Select
'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Paste Destination:=Range("E2")
ftwbook.Activate
ActiveWindow.Close
End Sub