Object Required

  • Thread starter Thread starter Patrick Simonds
  • Start date Start date
P

Patrick Simonds

I get an Object Required error when I run the code below. I think I know why
but do not know how to fix it. The TextBoxes I am referencing are on
UserForm DataInput so I assume the Object that is Required is DataInput but
I do not know how to alter the code to include the Object.


TextBox88.Text = Worksheets("Income").Range("J3").Text
TextBox90.Text = Worksheets("Income").Range("L3").Text
 
Patrick said:
I get an Object Required error when I run the code below. I think I know why
but do not know how to fix it. The TextBoxes I am referencing are on
UserForm DataInput so I assume the Object that is Required is DataInput but
I do not know how to alter the code to include the Object.


TextBox88.Text = Worksheets("Income").Range("J3").Text
TextBox90.Text = Worksheets("Income").Range("L3").Text

Hi Patrick,

If the TextBoxes are on the activesheet, then try replacing
TextBox88.Text with...

ActiveSheet.Shapes("TextBox88").Text and similarly with the other
TextBox.

Ken Johnson
 
Hi Patrick,

When Excel names a Text Box it includes spaces so you might still have
trouble if those spaces are not included. Also, on my machine the .Text
doesn't work, I've had to use .TextFrame.Characters.Text, so maybe it
should be..

ActiveSheet.Shapes("Text Box 88").TextFrame.Characters.Text = etc

Ken Johnson
 
The TextBox is on a UserForm named Data_Input (which is open at the time the
code is run). Code below is intended to update the contents of the two
TextBoxes (on the active UserForm) as data is added to the worksheet.

TextBox88.Text = Worksheets("Income").Range("J3").Text
TextBox90.Text = Worksheets("Income").Range("L3").Text
 
Working with what you gave me I came up with a solution:

Data_Input("TextBox88").Text = Worksheets("Income").Range("J3").Text
Data_Input("TextBox90").Text = Worksheets("Income").Range("L3").Text
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top