Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Misunderstanding of Objects please clarify

I have some controls in an userfor, their contents (value/text) are the
result of a look up in a sheet. I want to update/change those values and
paste them back in the sheet in the same cells they come from. When I try to
do it I get the "Object Requiered" error.

Here is an example
ws.Range(X).Offset(0, 6).Text = FrmMove_In.CheckBox1.Caption

ws= is the sheet where I'm retrieving the record from
x=is the column where the record is.


Help is greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default Misunderstanding of Objects please clarify

hi,

Range(X) should be a range object not a number of columns
set X = Range("A1")

or
Set X = range("A1:B10")
--
Regards,

Halim



"LuisE" wrote:

I have some controls in an userfor, their contents (value/text) are the
result of a look up in a sheet. I want to update/change those values and
paste them back in the sheet in the same cells they come from. When I try to
do it I get the "Object Requiered" error.

Here is an example
ws.Range(X).Offset(0, 6).Text = FrmMove_In.CheckBox1.Caption

ws= is the sheet where I'm retrieving the record from
x=is the column where the record is.


Help is greatly appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Misunderstanding of Objects please clarify

I thin it is, this is the code


Set ws = Sheets("mysheet")
Set UnitList = ws.Range("a:a")

With UnitList
Set rFound = .Find(What:=UnitNo, _
After:=Range("A1"), LookIn:=xlValues, _
Lookat:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)


If Not rFound Is Nothing Then
X = rFound.Address
the rest of the code

"Halim" wrote:

hi,

Range(X) should be a range object not a number of columns
set X = Range("A1")

or
Set X = range("A1:B10")
--
Regards,

Halim



"LuisE" wrote:

I have some controls in an userfor, their contents (value/text) are the
result of a look up in a sheet. I want to update/change those values and
paste them back in the sheet in the same cells they come from. When I try to
do it I get the "Object Requiered" error.

Here is an example
ws.Range(X).Offset(0, 6).Text = FrmMove_In.CheckBox1.Caption

ws= is the sheet where I'm retrieving the record from
x=is the column where the record is.


Help is greatly appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Misunderstanding of Objects please clarify

Take a look at VBA's help for .text. You'll see that it's a readonly property
for a range object.

Try:
ws.Range(X).Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption

ps. Instead of using syntax like:
ws.Range(X).Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption
you could use:
rFound.Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption

And if this code is behind the userform, you may find it safer to use the key
word Me (the object that owns the code--in this case the userform itself).

rFound.Offset(0, 6).Value = me.CheckBox1.Caption

You won't have to worry about renaming the userform--or copy|pasting the code to
a new userform.



LuisE wrote:

I have some controls in an userfor, their contents (value/text) are the
result of a look up in a sheet. I want to update/change those values and
paste them back in the sheet in the same cells they come from. When I try to
do it I get the "Object Requiered" error.

Here is an example
ws.Range(X).Offset(0, 6).Text = FrmMove_In.CheckBox1.Caption

ws= is the sheet where I'm retrieving the record from
x=is the column where the record is.

Help is greatly appreciated.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Misunderstanding of Objects please clarify

I tried and it is still giving me an error.
Is t because The code for for rFound, X and ws is in another Module.





"Dave Peterson" wrote:

Take a look at VBA's help for .text. You'll see that it's a readonly property
for a range object.

Try:
ws.Range(X).Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption

ps. Instead of using syntax like:
ws.Range(X).Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption
you could use:
rFound.Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption

And if this code is behind the userform, you may find it safer to use the key
word Me (the object that owns the code--in this case the userform itself).

rFound.Offset(0, 6).Value = me.CheckBox1.Caption

You won't have to worry about renaming the userform--or copy|pasting the code to
a new userform.



LuisE wrote:

I have some controls in an userfor, their contents (value/text) are the
result of a look up in a sheet. I want to update/change those values and
paste them back in the sheet in the same cells they come from. When I try to
do it I get the "Object Requiered" error.

Here is an example
ws.Range(X).Offset(0, 6).Text = FrmMove_In.CheckBox1.Caption

ws= is the sheet where I'm retrieving the record from
x=is the column where the record is.

Help is greatly appreciated.


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Misunderstanding of Objects please clarify

I change the .text to .value and worked. Thanks a lot Dave.

"Dave Peterson" wrote:

Take a look at VBA's help for .text. You'll see that it's a readonly property
for a range object.

Try:
ws.Range(X).Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption

ps. Instead of using syntax like:
ws.Range(X).Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption
you could use:
rFound.Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption

And if this code is behind the userform, you may find it safer to use the key
word Me (the object that owns the code--in this case the userform itself).

rFound.Offset(0, 6).Value = me.CheckBox1.Caption

You won't have to worry about renaming the userform--or copy|pasting the code to
a new userform.



LuisE wrote:

I have some controls in an userfor, their contents (value/text) are the
result of a look up in a sheet. I want to update/change those values and
paste them back in the sheet in the same cells they come from. When I try to
do it I get the "Object Requiered" error.

Here is an example
ws.Range(X).Offset(0, 6).Text = FrmMove_In.CheckBox1.Caption

ws= is the sheet where I'm retrieving the record from
x=is the column where the record is.

Help is greatly appreciated.


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Misunderstanding of Objects please clarify

I think it's time to post your current code. And indicate what line causes the
trouble.


LuisE wrote:

I tried and it is still giving me an error.
Is t because The code for for rFound, X and ws is in another Module.

"Dave Peterson" wrote:

Take a look at VBA's help for .text. You'll see that it's a readonly property
for a range object.

Try:
ws.Range(X).Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption

ps. Instead of using syntax like:
ws.Range(X).Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption
you could use:
rFound.Offset(0, 6).Value = FrmMove_In.CheckBox1.Caption

And if this code is behind the userform, you may find it safer to use the key
word Me (the object that owns the code--in this case the userform itself).

rFound.Offset(0, 6).Value = me.CheckBox1.Caption

You won't have to worry about renaming the userform--or copy|pasting the code to
a new userform.



LuisE wrote:

I have some controls in an userfor, their contents (value/text) are the
result of a look up in a sheet. I want to update/change those values and
paste them back in the sheet in the same cells they come from. When I try to
do it I get the "Object Requiered" error.

Here is an example
ws.Range(X).Offset(0, 6).Text = FrmMove_In.CheckBox1.Caption

ws= is the sheet where I'm retrieving the record from
x=is the column where the record is.

Help is greatly appreciated.


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
general misunderstanding AK Excel Discussion (Misc queries) 1 March 18th 08 10:50 PM
Misunderstanding isblank strawberry Excel Worksheet Functions 5 March 22nd 07 12:46 PM
Range Object Misunderstanding Ken McLennan[_3_] Excel Programming 6 August 9th 05 09:00 AM
need to clarify John Sawyer Charts and Charting in Excel 0 July 18th 05 02:05 PM
clarify No Name Excel Programming 0 August 13th 04 09:49 PM


All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"