How to select all

AhmedRady

New Member
Joined
May 22, 2019
Messages
20
Dears,
i create drop list by using data validation + used Vlookup (VLOOKUP(cell of drop list;the below range;2;FALSE) :

Edrop list ( i need used "All" )
5vlookup ( i need all numbers appears )

<tbody>
</tbody>



<colgroup><col width="64" style="width:48pt"></colgroup><tbody>
</tbody>
it's working fine ((( when i select A number 1 appears and so on ))) but i need when select ALL (all data in column 2 appears )


all
A1
b2
c3
d4
e5
f6

<tbody>
</tbody>
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
When you select "All" you want all the numbers to appear.
You must explain exactly how all the information is:
- Where is the drop-list
- What type of drop-list, is a data validation
- Where are the data of the drop-list
- Where are the data and their respective number
- And where do you want the result?
- Can it be with a macro?

Please Note
-----------------------
One thing you must keep in mind when you ask a question in a forum... the people you are asking to help you know absolutely nothing about your data, absolutely nothing about how it is laid out in the workbook, absolutely nothing about what you want done with it and absolutely nothing about how whatever it is you want done is to be presented back to you as a result... you must be very specific about describing each of these areas, in detail, and you should not assume that we will be able to "figure it out" on our own. Remember, you are asking us for help... so help us to be able to help you by providing the information we need to do so, even if that information seems "obvious" to you (remember, it is only obvious to you because of your familiarity with your data, its layout and the overall objective for it).
 
Upvote 0
- Appreciate your note maybe because i still beginner so i can't ask the question in the right way

-Where is the drop-list
in the same sheet column C row 2
-What type of drop-list, is a data validation
yes
- Where are the data of the drop-list
in the same sheet 2 columns (A2:A7, B2:B6)
- Where are the data and their respective number

ABC
Namecoderesult
A1data validation- list (A column is the source)
B2(VLOOKUP(cell of drop list;A2:B7;2;FALSE)
c3
d4
e5
f6
all

<tbody>
</tbody>

- And where do you want the result?
in the cells under C2 ( under- list of data validation )
- Can it be with a macro?
yes by anyway
 
Upvote 0
- Appreciate your note maybe because i still beginner so i can't ask the question in the right way

-Where is the drop-list
in the same sheet column C row 2
-What type of drop-list, is a data validation
yes
- Where are the data of the drop-list
in the same sheet 2 columns (A2:A7, B2:B6)
- Where are the data and their respective number

- And where do you want the result?
in the cells under C2 ( under- list of data validation )
- Can it be with a macro?
yes by anyway

Put the following code in the events of your sheet

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address(False, False) = "C2" Then
        If Target.Count > 1 Then Exit Sub
        Range("C3:C" & Rows.Count).ClearContents
        If LCase(Target.Value) = LCase("all") Then
            x = Range("B2", Range("B" & Rows.Count).End(xlUp)).Rows.Count
            Range("C3").Resize(x).Value = Range("B2", Range("B" & Rows.Count).End(xlUp)).Value
        Else
            Set f = Range("A:A").Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
            If Not f Is Nothing Then
                Target.Offset(1).Value = f.Offset(, 1).Value
            End If
        End If
    End If
End Sub

SHEET EVENT
Right click the tab of the sheet you want this to work, select view code and paste the code into the window that opens up.


--------

My file test:
https://www.dropbox.com/s/tosj3m7uaf2e67c/test all.xlsm?dl=0
 
Upvote 0
thanks Very much , it's working fine
how you solve it . :oops: i hope to be at that level which enable my implement my ideas
 
Upvote 0
thanks Very much , it's working fine
how you solve it . :oops: i hope to be at that level which enable my implement my ideas


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address(False, False) = "C2" Then
        If Target.Count > 1 Then Exit Sub

'clear area
        Range("C3:C" & Rows.Count).ClearContents

'if selected "all"
        If LCase(Target.Value) = LCase("all") Then

'copy data from range B2-down to c3
            x = Range("B2", Range("B" & Rows.Count).End(xlUp)).Rows.Count
            Range("C3").Resize(x).Value = Range("B2", Range("B" & Rows.Count).End(xlUp)).Value
        Else

'another selection, I use the find method and I take the data from the right
            Set f = Range("A:A").Find(Target.Value, LookIn:=xlValues, lookat:=xlWhole)
            If Not f Is Nothing Then
                Target.Offset(1).Value = f.Offset(, 1).Value
            End If
        End If
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,179
Members
448,871
Latest member
hengshankouniuniu

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