variable List creation

Pheonix2332

New Member
Joined
Feb 3, 2021
Messages
20
Office Version
  1. 2013
Platform
  1. Windows
good afternoon all - bit of a long one im sorry

and hopefully somebody can spot my mistake here , I have been trying to collate a batch of data for work to make my life a little easier and to save myself the best part of a day scrubbing spreadsheets for info I need. I am trying to collate a list of traders I deal with on a regular basis but this will change on a monthly level and is updated daily, so far I have been able to gather the data into the sheet I need for the raw data and now I have been able to isolate out the names of the traders and remove the duplicates. using the following code below this is the duplication removal part . The issue Im now having is that due to this list changing on a daily basis - start of each month to last day the figure will increase based on the number of times contact has been made to each trader this is why its deleted each day and re copied across.

is there a way that this can be configured so that I can have a dropdown box on my inital sheet to auto filter out the traders I need to review ? I have attached a screen shot of the current lay out - extract pulls the information across daily when run this works fine , I need the Filter traders to do what it does currently but also allow creation of a variable dropdown box in cell G2 from the list of traders names on sheet input, when this is done Im hoping to then be able to select the trader in G2 and have this traders details then copied into Results. and export to be used when needing to send a copy on to a colleague to work through at ease . any help would be a huge time saver as trying to use limited knowlage of VBA - mostly from memory going back to school ( over 20 years ago) and from trying to hash together Youtube videos and some code from here. I appreciate any support possible thanks - the code below is how im hoping it should be but keep geting a validation error and cant see whats wrong. can the data validation be linked to the table without using the range needed or is this a necessity ? cheers all

Excel Formula:
Sub Button3_Click()

Dim Rng As Range
Dim SRng As Range

Application.ScreenUpdating = False

Sheets("input").Select
Range("A1", Range("A1").End(xlDown)).Delete

 Range("A1").Value = "Trader Names"
Sheets("Data").Select
Range("V2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("input").Select
    Range("A2").Select
    ActiveSheet.Paste
    Range("A1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.FormatConditions.AddUniqueValues
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    Selection.FormatConditions(1).DupeUnique = xlDuplicate
    With Selection.FormatConditions(1).Font
        .Color = -16383844
        .TintAndShade = 0
    End With
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 13551615
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = False
    
Set Rng = Range("A1", Range("A1").End(xlDown).End(xlToRight))
Set SRng = Range("A1", Range("A1").End(xlDown))
    
Rng.Sort Key1:=SRng, Order1:=xlAscending, Header:=xlYes

SRng.RemoveDuplicates Columns:=1, Header:= _
        xlYes

Range("A1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    ActiveSheet.ListObjects.Add(xlSrcRange, Range:= SRng.Value , , xlYes).Name = _
        "Table1"
    Range("Table1[[#All],[Trader Names]]").Select
    Sheets("Start").Select
    Range("G2").Select
    With Selection.Validation
        .Delete
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
        xlBetween, Formula1:="=input!$A$2:$A$234"
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = ""
        .InputMessage = ""
        .ErrorMessage = ""
        .ShowInput = True
        .ShowError = True




Application.ScreenUpdating = True

MsgBox "Duplicates removed "

end sub
 

Attachments

  • Collate screen shot .png
    Collate screen shot .png
    17.7 KB · Views: 15

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,224,814
Messages
6,181,124
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top