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