+ Reply to Thread
Results 1 to 9 of 9

Looking For VBA Script which help to Populate the result by selecting Partner

Hybrid View

  1. #1
    Registered User
    Join Date
    10-26-2012
    Location
    new delhi
    MS-Off Ver
    Excel 2016
    Posts
    19

    Looking For VBA Script which help to Populate the result by selecting Partner

    Hi Fellow Members,

    Hope you are in good in health and safe!

    I have an query, i am looking for Code which help to populate the list of available model by qty and its value while selecting particular Partner from drop down list.

    Drop Down list is working but i am not able to create codes.

    Once i select any partner from drop down list, POP-up should appears with all the models listed with qty value and sum of qty/Value.

    Reference data is attached.. Working sheet is : Summary where all the data is reflecting.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,316

    Re: Looking For VBA Script which help to Populate the result by selecting Partner

    Possibly this will meet your needs...
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-26-2012
    Location
    new delhi
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Looking For VBA Script which help to Populate the result by selecting Partner

    Hi,

    Thanks for prompt reply.. File which you have shared, seems corrupted..Possible to re-share again?

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,316

    Re: Looking For VBA Script which help to Populate the result by selecting Partner

    Let's try this one...


    Nope. This one isn't opening well either... I must be doing something off....
    Last edited by dangelor; 08-06-2020 at 01:05 PM.

  5. #5
    Registered User
    Join Date
    10-26-2012
    Location
    new delhi
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Looking For VBA Script which help to Populate the result by selecting Partner

    Nope..Not working... An Error is "We found a problem with some content in Distributor Closing Stock End of July.xlsm"
    Last edited by bindassladka; 08-06-2020 at 01:12 PM.

  6. #6
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,316

    Re: Looking For VBA Script which help to Populate the result by selecting Partner

    They say 3rd time's the charm...

    ...they lied.

    Well below is the code in the document. Why it crashes, I don't know...
    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Address = "$B$3" Then
            Me.ListObjects(1).Range.AutoFilter Field:=2, Criteria1:=Target.Value
        End If
    End Sub
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        Dim rg As Range, ar As Variant
        Set rg = Me.Cells(6, 1).CurrentRegion.Columns(2)
        Set rg = rg.Offset(1).Resize(rg.Rows.Count - 1)
        ar = Data_Validation_List(rg)
        With Me.Cells(3, 2).Validation
            .Delete
            .Add Type:=xlValidateList, Formula1:=Join(ar, ",")
        End With
        
        If Target.Address = "$F$3" Then
            Me.Cells(3, 2).ClearContents
            Me.ListObjects(1).Range.AutoFilter Field:=2, Criteria1:="*"
            Me.Cells(3, 2).Select
        End If
    End Sub
    Function Data_Validation_List(rg As Range) As Variant
        Dim e, ar
        ar = Application.Index(rg.Value, 0, 0)
        With CreateObject("Scripting.Dictionary")
            For Each e In ar
                .Item(e) = Empty
            Next
            Data_Validation_List = .keys
        End With
    End Function
    Attached Files Attached Files
    Last edited by dangelor; 08-06-2020 at 01:24 PM.

  7. #7
    Registered User
    Join Date
    10-26-2012
    Location
    new delhi
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Looking For VBA Script which help to Populate the result by selecting Partner

    Sir,

    Really Sorry, File as well Code, both are not working..

  8. #8
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,316

    Re: Looking For VBA Script which help to Populate the result by selecting Partner

    I may be beating a dead horse here...

    This in the worksheet's code module
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Address = "$B$3" Then
            If Target.Value = vbNullString Then
                Me.ListObjects(1).Range.AutoFilter Field:=2, Criteria1:="*"
            Else
                Me.ListObjects(1).Range.AutoFilter Field:=2, Criteria1:=Target.Value
            End If
        End If
    End Sub
    ...and this in a standard code module.
    Sub Clear_Selection()
        Sheet1.Cells(3, 2).ClearContents
    End Sub
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-26-2012
    Location
    new delhi
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Looking For VBA Script which help to Populate the result by selecting Partner

    Thanks a lot for your time and patience. Both the things are working perfectly..

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] get the partner name from range of Partner name and rank to desired range formula
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2014, 11:46 AM
  2. need excel formula to get result from data table depends upon week,partner,column values
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2013, 08:41 AM
  3. Populate multiple tabs with a script
    By Uplifthim58! in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-16-2013, 09:33 AM
  4. [SOLVED] VB-script for result list
    By ruttian in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-21-2013, 06:30 AM
  5. Populate result in different cell when selecting from drop down list
    By techfashion in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2011, 02:10 PM
  6. Selecting rows for copying via VB script
    By cjboydell in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-26-2010, 12:43 PM
  7. Locating and selecting a column with VB Script
    By bigtonyicu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-24-2008, 02:17 PM
  8. Selecting the most recent file in a folder by Macro/VBA script
    By scott.k@ems-t.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2006, 01:15 PM

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