Is Match the correct procedure to use

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,752
Office Version
  1. 2007
Platform
  1. Windows
Basically on my userform I have commandbutton1 I plan to show / hide it depending on whether a value is present or not.

Let me explain.
The userform opens & the value in Textbox1 is noted. The value should be compared with Table 42. If Textbox1 value is present in Table 42 then hide commandbutton1, if the value isn’t present then show commandbutton1

Thanks.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Try:
VBA Code:
Private Sub TextBox1_Change()
  Dim f As Range
  Set f = Range("Table42").Find(TextBox1.Value, , xlValues, xlWhole, , , False)
  If Not f Is Nothing Then
    CommandButton1.Visible = True
  Else
    CommandButton1.Visible = False
  End If
End Sub

Private Sub UserForm_Activate()
  CommandButton1.Visible = False     'Change to True if you want the commandbutton to be visible when starting the userform
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,958
Messages
6,175,643
Members
452,663
Latest member
MEMEH

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