TxtBox value displays sheet

chiabgigi

New Member
Joined
Aug 30, 2009
Messages
48
Hi everyone
I would like that when a value appears in the TextBox1, that value must be compared with the column "AA" of the 'Main' sheet, and if the value is present select the sheet with the name corresponding to the searched value.
I tried but can't, please help / advice, thanks in advance.

VBA Code:
Private Sub TextBox1_AfterUpdate()
Dim ws As Worksheet

Dim wk_master As Workbook
Dim ws_master As Worksheet

Set wk_master = ActiveWorkbook
Set ws_master = wk_master.Worksheets("Main")

If Me.TextBox1.Value = ws_master.Cells(1, 26).Value Then
Set ws = ThisWorkbook.Worksheets(Me.TextBox1.Value)
ws.Select

End If
End Sub
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Would like to help but can't access your file.

Logging in to my Google account am told I don't have access
Clicking the Request Access button
am told will get an email letting me know if request is approved.
I get nothing.

your last 2 links are identical.

You could try using a free account at box.com for sharing files,
has worked well for me.

Other than that all I can do is wish you luck with your project.
 
Upvote 0
My Mac doesn't support ActiveX, so I had to disable them to get into the workbook. No problem, its a common occurance.
 
Upvote 0
well now you see the content. have you tried with the form 'Orders' to search for a name on the first combobox? the data will be put in the textbox but the sheet relative to the clicked name is not activated
 
Upvote 0
What combo box? The OP question was about getting a sheet named in a textbox to activate. There was no mention of a combobox in the OP.
 
Upvote 0
The update event isn't triggered when the textbox1 is populated like that.
try calling afterupdate after populating the textbox.
Rich (BB code):
Private Sub ComboBox1_Change()
Dim i As Long, LastRow As Long, ws As Worksheet
Set ws = Sheets("Clienti")
LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row

For i = 2 To LastRow
    If Me.ComboBox1.Value = ws.Cells(i, "A") Then
        MsgBox Me.ComboBox1.Value
        Me.TextBox1 = ws.Cells(i, "A").Value
        Call TextBox1_AfterUpdate
        Me.TextBox2 = ws.Cells(i, "B").Value
        Me.TextBox3 = ws.Cells(i, "C").Value
        Me.TextBox4 = ws.Cells(i, "D").Value
        Me.TextBox5 = ws.Cells(i, "E").Value
    End If
Next i
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,691
Members
448,978
Latest member
rrauni

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