Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Controlsource

Hi Guys

I've hit a bit of a problem and am hoping that you can help...

I've got a series of textboxes on a userform that I need to dynamically link
to various cells on the activesheet. Normally, this isn't an issue as

stagedetails.TextBox2.ControlSource = "D" & workingrow works
happily

However, what I need to do is specifiy both the column and row by variables,
using integers for both options. Again, I could normally use the Cells(x,y)
syntax but

stagedetails.TextBox2.ControlSource = ActiveSheet.Cells(workingrow, x + 2)

gives a "Runtime error '380': Could not set the ControlSource Property.
Invalid property value."

Now I know I could hack a routine together to convert integers to column
letters but it all seems a tad excessive - any ideas?

Many thanks

David


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Controlsource

Try:

stagedetails.TextBox2.Text = ActiveSheet.Cells(workingrow,
x + 2).Value

Let me know if that works, 'cuz I'm just taking a guess
here...

-----Original Message-----
Hi Guys

I've hit a bit of a problem and am hoping that you can

help...

I've got a series of textboxes on a userform that I need

to dynamically link
to various cells on the activesheet. Normally, this

isn't an issue as

stagedetails.TextBox2.ControlSource = "D" &

workingrow works
happily

However, what I need to do is specifiy both the column

and row by variables,
using integers for both options. Again, I could normally

use the Cells(x,y)
syntax but

stagedetails.TextBox2.ControlSource = ActiveSheet.Cells

(workingrow, x + 2)

gives a "Runtime error '380': Could not set the

ControlSource Property.
Invalid property value."

Now I know I could hack a routine together to convert

integers to column
letters but it all seems a tad excessive - any ideas?

Many thanks

David


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Controlsource

Thanks for that but it doesn't achieve the required linking between the text
box and the spreadsheet cell...

I could use this methodology but it's very messy as I'd have to manually
copy all the data between the cell & textbox whenever something changes and,
with 40+ textboxes, it's not my ideal way of spending a day coding!

Thanks anyway

David




"JoJo the Dancing Monkey" wrote in
message ...
Try:

stagedetails.TextBox2.Text = ActiveSheet.Cells(workingrow,
x + 2).Value

Let me know if that works, 'cuz I'm just taking a guess
here...

-----Original Message-----
Hi Guys

I've hit a bit of a problem and am hoping that you can

help...

I've got a series of textboxes on a userform that I need

to dynamically link
to various cells on the activesheet. Normally, this

isn't an issue as

stagedetails.TextBox2.ControlSource = "D" &

workingrow works
happily

However, what I need to do is specifiy both the column

and row by variables,
using integers for both options. Again, I could normally

use the Cells(x,y)
syntax but

stagedetails.TextBox2.ControlSource = ActiveSheet.Cells

(workingrow, x + 2)

gives a "Runtime error '380': Could not set the

ControlSource Property.
Invalid property value."

Now I know I could hack a routine together to convert

integers to column
letters but it all seems a tad excessive - any ideas?

Many thanks

David


.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Controlsource

David,

Problem is that controlsource is an address string, whereas
Cells(workingrow, x + 2) gives the defualt Value property. IT can be
circumvented with

stagedetails.TextBox2.ControlSource = ActiveSheet.Cells(workingrow, x +
2).address

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"David Coleman" wrote in message
...
Hi Guys

I've hit a bit of a problem and am hoping that you can help...

I've got a series of textboxes on a userform that I need to dynamically

link
to various cells on the activesheet. Normally, this isn't an issue as

stagedetails.TextBox2.ControlSource = "D" & workingrow works
happily

However, what I need to do is specifiy both the column and row by

variables,
using integers for both options. Again, I could normally use the

Cells(x,y)
syntax but

stagedetails.TextBox2.ControlSource = ActiveSheet.Cells(workingrow, x + 2)

gives a "Runtime error '380': Could not set the ControlSource Property.
Invalid property value."

Now I know I could hack a routine together to convert integers to column
letters but it all seems a tad excessive - any ideas?

Many thanks

David




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Controlsource

Thanks for that Bob - I knew it was something simple but hadn't thought of
the .address option.

Regards

David




"Bob Phillips" wrote in message
...
David,

Problem is that controlsource is an address string, whereas
Cells(workingrow, x + 2) gives the defualt Value property. IT can be
circumvented with

stagedetails.TextBox2.ControlSource = ActiveSheet.Cells(workingrow, x +
2).address

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"David Coleman" wrote in message
...
Hi Guys

I've hit a bit of a problem and am hoping that you can help...

I've got a series of textboxes on a userform that I need to dynamically

link
to various cells on the activesheet. Normally, this isn't an issue as

stagedetails.TextBox2.ControlSource = "D" & workingrow

works
happily

However, what I need to do is specifiy both the column and row by

variables,
using integers for both options. Again, I could normally use the

Cells(x,y)
syntax but

stagedetails.TextBox2.ControlSource = ActiveSheet.Cells(workingrow, x +

2)

gives a "Runtime error '380': Could not set the ControlSource Property.
Invalid property value."

Now I know I could hack a routine together to convert integers to column
letters but it all seems a tad excessive - any ideas?

Many thanks

David








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Controlsource

Change the code to

stagedetails.TextBox2.ControlSource = ActiveSheet.Cells
(workingrow, x + 2).Address(, , xlA1, True)


Kevin Beckham

-----Original Message-----
Hi Guys

I've hit a bit of a problem and am hoping that you can

help...

I've got a series of textboxes on a userform that I need

to dynamically link
to various cells on the activesheet. Normally, this

isn't an issue as

stagedetails.TextBox2.ControlSource = "D" &

workingrow works
happily

However, what I need to do is specifiy both the column

and row by variables,
using integers for both options. Again, I could normally

use the Cells(x,y)
syntax but

stagedetails.TextBox2.ControlSource = ActiveSheet.Cells

(workingrow, x + 2)

gives a "Runtime error '380': Could not set the

ControlSource Property.
Invalid property value."

Now I know I could hack a routine together to convert

integers to column
letters but it all seems a tad excessive - any ideas?

Many thanks

David


.

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
Change UserForm ControlSource with VBA [email protected] Excel Discussion (Misc queries) 2 February 24th 05 08:05 AM
ControlSource Compatibility VBA - VB6 John M[_4_] Excel Programming 2 October 19th 03 05:30 PM
ControlSource problem Christy[_2_] Excel Programming 1 August 28th 03 03:44 AM
Basic Userform Controlsource question Kevin Excel Programming 0 August 7th 03 11:04 PM
Valid ControlSource values Jason Gatsby Excel Programming 0 August 4th 03 07:36 PM


All times are GMT +1. The time now is 04:40 AM.

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"