View Single Post
 
Old 01-16-2017, 07:07 PM
walber walber is offline Windows 10 Office 2016
Novice
 
Join Date: Jan 2017
Posts: 3
walber is on a distinguished road
Default Help with UserForm

good evening everyone

I searched on websites and did not find my answer.
How do I get this code to work when I click G16 line from the Menu spreadsheet according to the template attachment.

Code:
Option Explicit
Private TextoDigitado As String
Private Sub ListBox1_Click()
ActiveCell.Value = ListBox1.Value
Unload Me
End Sub

Private Sub TextBox1_Change()
TextoDigitado = TextBox1.Text
Call PreencheLista
End Sub

Private Sub UserForm_Initialize()
Call PreencheLista
End Sub

Private Sub PreencheLista()
Dim ws As Worksheet
Dim i As Integer
Dim TextoCelula As String
Set ws = ThisWorkbook.Worksheets(2)
i = 2
ListBox1.Clear
With ws
While .Cells(i, 2).Value <> Empty
TextoCelula = .Cells(i, 2).Value
If UCase(Left(TextoCelula, Len(TextoDigitado))) = UCase(TextoDigitado) Then
ListBox1.AddItem .Cells(i, 2)
End If
i = i + 2
Wend
End With
End Sub
Thanks in advance
Attached Files
File Type: xlsm Projeto.xlsm (330.1 KB, 15 views)

Last edited by macropod; 01-16-2017 at 08:06 PM. Reason: Added code tags
Reply With Quote