Posts by mathew31

    Hello all i have this weird problem i cant wrap my head around.


    i know making a pie chart is easy, but the workbook I am using has certain unique challenges.
    in the attached file on the dashboard i need to create a pie chart in percentage of how many employees have assignment and how many do not have assignment as shown in the calender.....
    the data changes so it should be done in a macro....


    RMG Dashboard.xlsm

    Re: using the open file dialog box to avoid hard coding the file names..........


    Good Afternoon Roy,,,
    i get a method or data member not found error on lastrow = .Cells(Rows.Count, 1).End(xlUp).Row
    i guess i deleted soemthing by mistake..... and i cant figure it out...



    here is my entire code... what obvious thing am i missing


    hello all the above code matches header between two sheets and if they match copies the data......
    now the problem with this is that i have to hard code the file names always, which may cause someone to change the data in my code later so i want to avoid this approach and use the file open dialog box.
    now the lone for using a file open box has been added but as you can see the file names are still hardcoded.... now what do i replace them with?


    in the above example dashoard is my main workbook and the sheet name...
    global headcount is then name of the file and sheet which i want to take the data from.




    Re: using a dialog box to select the file for consolidation


    ill make it short and brief....


    the code that i have matches headers between two workbooks and copy pastes the data.....
    now this works but the problem is the user will have to go inside the code and give the name of the workbooks and the sheets and i want to avoid it using a file open dialog box....
    in my code global headcount is the name of my file and headsheet from where i want to copy the data, and dashboard is the name of the workbook and sheet which i wan to paste them tooo.


    hope that helps jindon..... this is the only problem i am facing....
    please advise

    Re: using a dialog box to select the file for consolidation


    fn = "'" & Left$(fn, InStrRev(fn, Application.PathSeparator)) & _ "[" & Mid$(fn, InStrRev(fn, Application.PathSeparator) + 1) & "]sheet1'!"
    x = ExecuteExcel4Macro(fn & "r1c1") x = ExecuteExcel4Macro("match(""" & .Cells(1, i).Value & _ """," & fn & "r1:r1,0)") If IsNumeric(x) Then y = ExecuteExcel4Macro("counta(" & fn & "c" & x & ":c" & x & ")") For ii = 2 To y .Cells(ii, i).V