manbearpig2020
New Member
- Joined
- Feb 6, 2017
- Messages
- 4
Hello all!
This is my first post on here. From what I have seen, you guys are enormously helpful. I thought I would put forward my questoin
I have hit a wall trying to create a custom function in VBA. I am trying to find unique values in a list of copied values in some column. This is displayed in one column. I then want a list of unique functions to be displayed falling.
I actually have a macro working for that piece of it. I just cannot get the input and output sections to work properly. I want them to look/work like the SUM function. Where the function box can pop up and ask for the inputs and outputs. The output would just be a single cell. The input would be an array.
Does anyone know how to set user designated input and output up?
Thanks!
This is my first post on here. From what I have seen, you guys are enormously helpful. I thought I would put forward my questoin
I have hit a wall trying to create a custom function in VBA. I am trying to find unique values in a list of copied values in some column. This is displayed in one column. I then want a list of unique functions to be displayed falling.
I actually have a macro working for that piece of it. I just cannot get the input and output sections to work properly. I want them to look/work like the SUM function. Where the function box can pop up and ask for the inputs and outputs. The output would just be a single cell. The input would be an array.
Does anyone know how to set user designated input and output up?
Thanks!
Code:
Option Explicit
Function GetUniques()
'For reference I have been working from this resource http://www.mrexcel.com/forum/showthread.php?649576-Extract-unique-values-from-one-column-using-VBA
Dim d As Object, c As Variant, i As Long, lr As Long
Set d = CreateObject("Scripting.Dictionary")
lr = Cells(Rows.Count, 1).End(xlUp).Row
c = Range("A2:A" & lr)
For i = 1 To UBound(c, 1)
d(c(i, 1)) = 1
Next i
Range("XFD1048576").Select
Selection.End(xlToLeft).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
ActiveCell.Offset(, 1).Select
ActiveCell.FormulaR1C1 = "Unique List"
ActiveCell.Offset(1).Select
Range(ActiveCell, ActiveCell).Resize(d.Count) = Application.Transpose(d.keys)
End Function