Posts by biggree

    Re: Run time error - 9


    thanks cytop but i am still getting error on below line:


    Code
    sht.Range("A1:CQ500").Copy Destination:=wsMaster.Sheets(sht.Range("A4").Value).Range("A" & r).Offset(1, 0)


    Also the tab names could be MC or NSW or QLD or VIC or TOT any of the 5.

    Re: Run time error - 9


    the error is errors in any of the below, when it fails to find the tab name.



    Code
    [COLOR=blue]If[/COLOR] Sheets("MC").Range("A4") = "MC" [COLOR=blue]Then[/COLOR]                     xlsFiles.Sheets("MC").Range("A1:cq500").Copy Destination:=wsMaster.Sheets("MC").Range("A" & r).Offset(1, 0)                                      [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]                                  [COLOR=blue]If[/COLOR] Sheets("NSW").Range("A4") = "NSW" [COLOR=blue]Then[/COLOR]                     xlsFiles.Sheets("NSW").Range("A1:cq500").Copy Destination:=wsMaster.Sheets("NSW").Range("A" & r).Offset(1, 0)                 [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]                                  [COLOR=blue]If[/COLOR] Sheets("QLD").Range("A4") = "QLD" [COLOR=blue]Then[/COLOR]                     xlsFiles.Sheets("QLD").Range("A1:cq500").Copy Destination:=wsMaster.Sheets("QLD").Range("A" & r).Offset(1, 0)                 [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]                                  [COLOR=blue]If[/COLOR] Sheets("VIC").Range("A4") = "VIC" [COLOR=blue]Then[/COLOR]                     xlsFiles.Sheets("VIC").Range("A1:cq500").Copy Destination:=wsMaster.Sheets("VIC").Range("A" & r).Offset(1, 0)                 [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]                                  [COLOR=blue]If[/COLOR] Sheets("TOT").Range("A4") = "TOT" [COLOR=blue]Then[/COLOR]                     xlsFiles.Sheets("TOT").Range("A1:cq500").Copy Destination:=wsMaster.Sheets("TOT").Range("A" & r).Offset(1, 0)                 [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]

    Re: Run time error - 9


    its refers to book which it will open.


    the file where i want the information be pasted is called Summary and user will select random file name.

    Hope someone can help me, I have the below code (got from few website and modified) which for some reason its not running the code and giving me an error message.


    to Summarize what I am doing, I want the user be able to select files which have extension of XLSX or XLSM only. And then open file find the tab name which is either MC, NSW, VIC, QLD, TOT and paste the information in respective tab on my current file which also has the same tab.


    the file the user select can have one or more tab names and not necessarily will have them all which is MC, NSW, VIC, QLD, TOT and will also have some extra tabs as well which I am not interested in.


    Re: Merging One Sheet from Multiple Workbooks into One Master


    try the below code: