+ Reply to Thread
Results 1 to 15 of 15

Function to list names dynamically based on Qty

  1. #1
    Registered User
    Join Date
    02-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Function to list names dynamically based on Qty

    Hi,

    I have interesting problem to solve and am looking for some help regarding the same.

    I have three columns. Product, Model Qty, Model. Each Product has Quantity listed beside. There will be a default Qty as 2 and the Models named after the product and qty are to be displayed. If I change the Qty to 3 or 4, then I would like the Models to increase accordingly and vice-versa. Also would like to sort the list of models as listed the product column. I have attached a sample excel sheet. Please help.

    Thanks,
    Ranga
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    02-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Function to list names dynamically based on Qty

    Can anybody help me on this request ?

  3. #3
    Registered User
    Join Date
    02-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Function to list names dynamically based on Qty

    Any help..guys ?

  4. #4
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Function to list names dynamically based on Qty

    Be a little bit patient please at least 9 members have looked at your file and are thinking about it, not sure how long you have been working on it, but it seems a sure bet that it has been longer than the people who have looked at your sample..
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  5. #5
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Function to list names dynamically based on Qty

    Also...is the "product list" going to be organized 'Alphabetically', as in your example?

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Function to list names dynamically based on Qty

    If you are interested, I can offer you VBA code in seconds but not interested to give a try with Worksheet Functions


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  7. #7
    Registered User
    Join Date
    02-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Function to list names dynamically based on Qty

    Hi,

    The product list need not be sorted.

    Thanks,
    Ranga

  8. #8
    Registered User
    Join Date
    02-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Function to list names dynamically based on Qty

    Not a Problem. please share what you have..Thanks,

  9. #9
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Function to list names dynamically based on Qty

    Do right click on sheet tab and select view code and copy and paste the below in the code window

    Please Login or Register  to view this content.
    Refer the attached excel for details.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    02-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Function to list names dynamically based on Qty

    Hi Sixthsense,

    The code worked well for me. Thanks a bunch.

  11. #11
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Function to list names dynamically based on Qty

    Glad it helps you and thanks for the feedback and rep

  12. #12
    Registered User
    Join Date
    02-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Function to list names dynamically based on Qty

    Hi SixSense,

    I am running into a small problem while executing the script in my sheet. I have used a SAVE button to move the output to another sheet called Analytics. The above script works fine until i hit SAVE. Once i hit save, the above script stops doing what it was doing. I think the SAVE script is disabling the functionality of the above script but i don't know what it is. Can you please help ?

    SAVE Button Script

    Sub CopyData()
    'To save the data from INPUT Sheet to ANALYTICS Sheet
    Sheets("Analytics").Range("M" & Rows.Count).End(xlUp).Offset(1, -12).Resize(15, 13).Value = Sheets("Input").Cells(3, 1).Resize(15, 13).Value

    End Sub


    Your scripts changed according to my sheet.


    Private Sub Worksheet_Change(ByVal Target As Range)

    If Intersect(Target, Range("D:E")) Is Nothing Then Exit Sub
    Dim nEndRw As Long, nTemp As Long, i As Long, x As Long, nStCel As Long

    Range("F2:F" & Rows.Count).ClearContents
    nEndRw = Cells(Rows.Count, "D").End(xlUp).Row
    nStCel = 2

    Application.ScreenUpdating = False

    For i = 2 To nEndRw
    If IsNumeric(Cells(i, "E").Value) And Cells(i, "D").Value <> "" Then
    nTemp = Cells(i, "E").Value
    For x = 1 To nTemp
    Cells(nStCel + x, "F").Value = Cells(i, "D").Value & "-" & x
    Next x
    nStCel = nStCel + nTemp
    End If
    Next i

    Application.ScreenUpdating = True

    End Sub

  13. #13
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Function to list names dynamically based on Qty

    The code seems to be perfect and not seeing anything to stop the event

  14. #14
    Registered User
    Join Date
    02-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Function to list names dynamically based on Qty

    Sixthsense,

    It works fine now. I didn't update the scripts after adding few columns and that has caused the deactivation of the script. Thanks for looking into it.

    Thanks again.

  15. #15
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Function to list names dynamically based on Qty

    Glad you fixed it and thanks for the feedback

+ 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