Trouble setting Control Source property in text box

Glenn_Suggs

New Member
Joined
Aug 9, 2012
Messages
13
I'm having trouble with a user form that contains three text boxes. I want to set the control source for each to one of three cells on a worksheet (A1,A2,A3). I'm using the following syntax. Can you please tell me where I'm going wrong? I get the message "Application-defined or object-defined error." I'm using Chr(34) to place the two double-quotes in the Range part.

dim i as integer

For i = 1 to 3
Me("txtPub" & Format(i, "0")).ControlSource = ActiveWorkbook.Sheets("Sheet1").Range(Chr(34) & "A" & Format(i, "0") & Chr(34))
Next i

Thanks in advance.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,215,461
Messages
6,124,955
Members
449,200
Latest member
indiansth

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