ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Object Required (https://www.excelbanter.com/excel-programming/369460-object-required.html)

Patrick Simonds

Object Required
 
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



Ken Johnson

Object Required
 

Patrick Simonds wrote:
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


Ken Johnson

Object Required
 
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


Patrick Simonds

Object Required
 
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




"Ken Johnson" wrote in message
ps.com...

Patrick Simonds wrote:
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




Patrick Simonds

Object Required
 
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

"Patrick Simonds" wrote in message
...
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




"Ken Johnson" wrote in message
ps.com...

Patrick Simonds wrote:
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






Ken Johnson

Object Required
 

Hi Patrick,

It's nice to know my wrong answer wasn't a total loss:-)

Ken Johnson



All times are GMT +1. The time now is 07:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com