assigning a value to a variable

Phillip2

Board Regular
Joined
Aug 5, 2019
Messages
79
Office Version
  1. 365
Platform
  1. Windows
I have a worksheet with 100 buttons. Each button represents a Customer’s record number. I’m working on a macro to assign to each button that when clicked would do the following:
  • Open the userform CCX_Form
  • Assign the customer’s record number to the variable TBrecord
  • Run the subroutine Private Sub Search_Click()
My form opens, but I’m getting an error 424 (Object Required) when using the following code. What am I missing?

VBA Code:
Sub Rectangle1_Click()
CCX_Form.Show
TBrecord.Value = "001"
Call Sub Search
End Sub

Thank you in advance for your time and help.
 
Thanks Fluff, I really appreciate your help. I was afraid of that. I'll just take it out and press a search button when the form opens.
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
If you put Search_click into the initialize event (as per your image in post#11) then you don't need to click the button
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,864
Members
449,052
Latest member
Fuddy_Duddy

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