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
 

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

NoSparks

Well-known Member
Joined
Mar 15, 2013
Messages
998
Office Version
  1. 2010
Platform
  1. Windows
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.
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,804

ADVERTISEMENT

It worked fine for me with the linked file. (Once I got around the ActiveX controls).
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,804

ADVERTISEMENT

My Mac doesn't support ActiveX, so I had to disable them to get into the workbook. No problem, its a common occurance.
 

chiabgigi

New Member
Joined
Aug 30, 2009
Messages
48
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
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,804
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.
 

NoSparks

Well-known Member
Joined
Mar 15, 2013
Messages
998
Office Version
  1. 2010
Platform
  1. Windows
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:

Watch MrExcel Video

Forum statistics

Threads
1,112,805
Messages
5,542,601
Members
410,561
Latest member
Sasha Lawrence
Top