+ Reply to Thread
Results 1 to 5 of 5

Transfer Data to separate tables based two variables (site and product)

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-28-2009
    Location
    Portland, Maine
    MS-Off Ver
    Excel 2003
    Posts
    102

    Transfer Data to separate tables based two variables (site and product)

    - I have a data entry tab for tracking unit volume and cost of products needed for each site

    - I need to transfer the five columns of data (UNIT COST, UNITS, LABOR COST, LABOR HOURS, TOTAL COST) to individual tables (UnitCost_TBL, UnitsTotal_TBL, LaborCost_TBL, LaborHRs_TBL, Total_TBL)

    - I need to mach on the PRACTICE and PRODUCT (both named ranges on data entry tab)

    - I've tried to modify to other programs that do a similar thing but they are both too complicated for me at this point.

    - Spreadsheet is attached.

    - Any help is greatly appreciated as always.

    Thanks!
    Attached Files Attached Files
    Last edited by yunesm; 04-15-2010 at 09:47 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Transfer Data to separate tables based two variables (site and product)

    Hi

    1) Will all the output sheets have all the Practices and Products? Or will you have to add items that don't exist.
    2) I'm presuming that you want to put data into the data entry, then push a button and have that data transferred, then clear out the data entry tab.
    3) What happens if there is already an entry for the particular practice / product combination?

    rylo

  3. #3
    Forum Contributor
    Join Date
    10-28-2009
    Location
    Portland, Maine
    MS-Off Ver
    Excel 2003
    Posts
    102

    Re: Transfer Data to separate tables based two variables (site and product)

    1) Will all the output sheets have all the Practices and Products? (Yes)

    2) I'm presuming that you want to put data into the data entry, then push a button and have that data transferred, then clear out the data entry tab (Yes, exactly)

    3) What happens if there is already an entry for the particular practice / product combination (It should be overwritten. This is going to be updated as a current state document. So when something changes the previous values should just be overriden)

    Did this help?

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Transfer Data to separate tables based two variables (site and product)

    Hi

    You will need to specify the array base to use so at the top of the general module enter
    option base 1
    Then try
    Sub aaa()
      shtarr = Array("UnitCost_TBL", "UnitsTotal_TBL", "LaborCost_TBL", "LaborHRs_TBL", "Total_TBL")
      For Each ce In Range("A6:A" & Cells(Rows.Count, 1).End(xlUp).Row)
        outrow = WorksheetFunction.Match(ce, Sheets("UnitCost_TBL").Range("A:A"), 0)
        outcol = WorksheetFunction.Match(Range("B1"), Sheets("UnitCost_TBL").Rows("1:1"), 0)
        For I = LBound(shtarr) To UBound(shtarr)
          Sheets(shtarr(I)).Cells(outrow, outcol).Value = ce.Offset(0, I).Value
        Next I
      Next ce
    End Sub
    This will paste the values to the relevant sheets.

    See how that goes. Note that in the example file you are missing the product Call Bells In Pt Bathrooms (Nurse Call System). As this has been designed with all the products in the output sheets, it will just error.

    rylo

  5. #5
    Forum Contributor
    Join Date
    10-28-2009
    Location
    Portland, Maine
    MS-Off Ver
    Excel 2003
    Posts
    102

    Re: Transfer Data to separate tables based two variables (site and product)

    This works great! Thanks for your help!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1