VBA for list from another coulmn each value once

amit96

New Member
Joined
Feb 15, 2022
Messages
27
Office Version
  1. 2013
Platform
  1. Windows
hello

i need a VBA code that gives me a list in cell B20 that contains values from sheet1 coulmn B:B.
if value is writen 2 times, so give it to me only once. if value is writen oce, give it to me as well.
each valuse only once.

thank you!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Gives the output in column C

VBA Code:
Sub jec()
 Dim ar As Variant, i As Long
 ar = Range("B1", Range("B" & Rows.Count).End(xlUp))
 
 With CreateObject("scripting.dictionary")
   For i = 1 To UBound(ar)
      .Item(ar(i, 1)) = Empty
   Next
   Cells(1, 3).Resize(.Count) = Application.Transpose(.keys)
 End With
End Sub
 
Upvote 0
Gives the output in column C

VBA Code:
Sub jec()
 Dim ar As Variant, i As Long
 ar = Range("B1", Range("B" & Rows.Count).End(xlUp))
 
 With CreateObject("scripting.dictionary")
   For i = 1 To UBound(ar)
      .Item(ar(i, 1)) = Empty
   Next
   Cells(1, 3).Resize(.Count) = Application.Transpose(.keys)
 End With
End Sub
I dont understand. how does it know to take the data from sheet1 coulmn B? and the output list should appear in sheet2 coulmn B20
 
Upvote 0
Gives the output in column C

VBA Code:
Sub jec()
 Dim ar As Variant, i As Long
 ar = Range("B1", Range("B" & Rows.Count).End(xlUp))
 
 With CreateObject("scripting.dictionary")
   For i = 1 To UBound(ar)
      .Item(ar(i, 1)) = Empty
   Next
   Cells(1, 3).Resize(.Count) = Application.Transpose(.keys)
 End With
End Sub
i only need to know how to take the data from sheet1 in coulmn B. all the rest i figuerd out
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,987
Members
452,373
Latest member
TimReeks

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