• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro issue

Dee

Member
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
 
Dee,

The way you have written it the sheet "DFMA MAKE" must be in the workbook which has the Macro

is that what you wanted?
 
yes, exactly....

is there any other way(rewriting macro by taking any examle) to get what i wanted? pls suggest
 
Dee

Have a look through

http://chandoo.org/forums/topic/need-macro-help

There should be enough there to help you out
 
Back
Top