+ Reply to Thread
Results 1 to 6 of 6

Need help qith formula

  1. #1
    Registered User
    Join Date
    10-16-2004
    Posts
    14

    Need help with formula

    I am trying to get my spreadsheet to automatically take records from one worksheet (titled All) to other tabs based on the contents of a column (Department, column H) The workbook is laid out with an All tab and a dozen or so Department tabs. If I have a record (Model Number, Item Name, Inv Count 1-4, Total, Department, Category, Family) on the All tab I would like all the data to automatically copy to the specific Departments tab (ie if cell H2 = Appliances move the contents of A2, B2, C2, D2, E2, F2, G2, H2, I2 and J2 to the corresponding columns, not necessarily the corresponding rows, on the Appliances tab.) The maximum row the departments could actually fill down to on the All tab is 2501. I'm sure it should be a vlookup formula but I can't figure out the syntax I should use.

    Here is the pertinent information (column headings and tab names)
    Column Headings

    Model
    Description
    Count (merged over columns c,d,e & f but no digital data will ever be in these cells, for handwritten data when printed)
    Total (no digital data will ever be in this cell, for handwritten data when printed)
    Dept
    Category
    Family


    Worksheets

    All
    Appliances
    Automotive
    Bed & Bath
    Books & Software
    Clearance
    Electronics Acc.
    Fashion
    Furniture
    Home
    Home Decor
    Home Office
    Houswares
    Luggage
    Personal Care
    Photo
    Seasonal
    Sports & Recreation
    Telephones
    Tools
    Toys

    Thanks in advance for any help you fine folks can provide

    -Dave
    Last edited by cynder77; 01-21-2005 at 04:43 PM.

  2. #2
    Forum Contributor
    Join Date
    04-30-2004
    Posts
    122
    Would it be possible for you to use a macro? If you want to use formulas, it might not be as simple as you think. You can create an update macro which you can link to a button that will update the different worksheets with the information. This is something that will be continuously updated, correct?

  3. #3
    Registered User
    Join Date
    10-16-2004
    Posts
    14
    Actually it's sort of a once quarterly thing. Basically I am trying to extract a count list for our stores for inventory from our Inventory Database system. It is a very rudimentary data base system but I can export data that I need to make it more usable in Excel. I've never before created a macro in Excel so if you could maybe walk me through what I need to do I'd really appreciate it. Our quarterly inventory is coming up at the start of Feb. so I need to get this figured out quickly or I'll be doing alot of cutting and pasting

    Thanks again,
    Dave

  4. #4
    Forum Contributor
    Join Date
    04-30-2004
    Posts
    122
    Sub RunData()

    Application.ScreenUpdating = False
    Worksheets("All").Activate
    Range("H2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Replace What:="/", Replacement:="&", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False
    MaxRow = ActiveSheet.Cells(Rows.Count, "H").End(xlUp).Row
    For i = 2 To MaxRow
    Worksheets("All").Activate
    sName = Cells(i, 8)
    Range(Cells(i, 1), Cells(i, 10)).Copy
    Worksheets(sName).Activate
    PasteRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Cells(PasteRow + 1, 1).Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False
    Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False
    Cells(1, 1).Select
    Next i

    Worksheets("Appliances").Activate
    Area1 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area1, 7)).Select
    a1 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a1
    Cells(1, 1).Select

    Worksheets("Automotive").Activate
    Area2 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area2, 7)).Select
    a2 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a2
    Cells(1, 1).Select

    Worksheets("Bed & Bath").Activate
    Area3 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area3, 7)).Select
    a3 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a3
    Cells(1, 1).Select

    Worksheets("Books & Software").Activate
    Area4 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area4, 7)).Select
    a4 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a4
    Cells(1, 1).Select

    Worksheets("Clearance").Activate
    Area5 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area5, 7)).Select
    a5 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a5
    Cells(1, 1).Select

    Worksheets("Electronics Acc.").Activate
    Area6 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area6, 7)).Select
    a6 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a6
    Cells(1, 1).Select

    Worksheets("Fashion").Activate
    Area7 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area7, 7)).Select
    a7 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a7
    Worksheets("All").Select
    Cells(1, 1).Select

    Worksheets("Furniture").Activate
    Area8 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area8, 7)).Select
    a8 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a8
    Cells(1, 1).Select

    Worksheets("Home").Activate
    Area9 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area9, 7)).Select
    a9 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a9
    Cells(1, 1).Select

    Worksheets("Home Decor").Activate
    Area10 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area10, 7)).Select
    a10 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a10
    Cells(1, 1).Select

    Worksheets("Home Office").Activate
    Area11 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area11, 7)).Select
    a11 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a11
    Cells(1, 1).Select

    Worksheets("Housewares").Activate
    Area12 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area12, 7)).Select
    a12 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a12
    Cells(1, 1).Select

    Worksheets("Luggage").Activate
    Area13 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area13, 7)).Select
    a13 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a13
    Cells(1, 1).Select

    Worksheets("Personal Care").Activate
    Area14 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area14, 7)).Select
    a14 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a14
    Cells(1, 1).Select

    Worksheets("Photo").Activate
    Area15 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area15, 7)).Select
    a15 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a15
    Cells(1, 1).Select

    Worksheets("Seasonal").Activate
    Area16 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area16, 7)).Select
    a16 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a16
    Cells(1, 1).Select

    Worksheets("Sports & Recreation").Activate
    Area17 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area17, 7)).Select
    a17 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a17
    Cells(1, 1).Select

    Worksheets("Telephones").Activate
    Area18 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area18, 7)).Select
    a18 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a18
    Cells(1, 1).Select

    Worksheets("Tools").Activate
    Area19 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area19, 7)).Select
    a19 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a19
    Cells(1, 1).Select

    Worksheets("Tools").Activate
    Area20 = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    Range(Cells(1, 1), Cells(Area20, 7)).Select
    a20 = Selection.Address
    ActiveSheet.PageSetup.PrintArea = a20
    Cells(1, 1).Select

    Worksheets("All").Activate
    Cells(1, 1).Select
    SendKeys "{Esc}", True

    Application.ScreenUpdating = True
    End Sub
    Last edited by Rutgers_Excels; 01-24-2005 at 04:12 PM.

  5. #5
    Registered User
    Join Date
    10-16-2004
    Posts
    14
    Hey I understand the Friday night rush for the door as well as any!!! Have a good night and I hope to talk to you on Monday. Morning for me is probably different than it is for you since you seem to be getting out a couple hours before the buzzer rings here. If you are East coast then I am 2 hours behind you and will be in at about 9:30am Monday morning your time. Once again, thanks for your help.

    -Dave

  6. #6
    Registered User
    Join Date
    10-16-2004
    Posts
    14
    here's my template
    Attached Files Attached Files

+ 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