Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

need help on my code VB application


  • Please log in to reply

#1
kobi129

kobi129

    New Member

  • Member
  • Pip
  • 2 posts
: What this code does is to pull the decription from the excel spreadsheet fill the next cell (Column B) when click the drop down in Column A. Will appreciate your help. Thanks..



Sub Equipment_Group_change() [b]'error on Sub Equipment_Group_change()
' Sub procedure definition
'Private Sub controlsheet1()

'End Sub
Dim MyUniqueList As Variant 'error on Dim MyUniqueLine As Variant
Dim i As Variant
Dim cl As Range
Dim usr_Form As Variant
With usr_Form.cbo_pos

.Clear ' clear the drop down list content
MyUniqueList = PosItemList(tbl_2_Current_Location_Register.Range("E:E9"), True)
For i = 1 To UBound(MyUniqueList)
.AddItem MyUniqueList(i)
Next i
.ListIndex = 0 ' select the first item
End With
'End Sub
Private Function PosItemList(InputRange As Range, HorizontalList As Boolean) As Variant

'End Function
Dim cl As Range, cUnique As New Collection, i As Variant, uList() As Variant

Application.Volatile

On Error Resume Next

For Each cl In InputRange

If cl.Formula <> "" Then

cUnique.Add cl.Value, CStr(cl.Value)
End If
Next cl
PosItemList = ""
If cUnique.Count > 0 Then
ReDim uList(1 To cUnique.Count)
For i = 1 To cUnique.Count
uList(i) = cUnique(i)
Next i
PosItemList = uList
If Not HorizontalList Then
PosItem = Application.WorksheetFunction.Transpose(PosItemList)

End If
End If
On Error GoTo 0
End Function
  • 0

Advertisements







Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP