Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formula links in text boxes?

I'm newly experimenting with VBA, so apologies if this is a stupid
question. Any help much appreciated!

I have a For - Next loop that creates a formula linking a cell in an
'input sheet' ("Key") to a cell in any one of 200 sheets. For cells,
this is no problem, using:

For i = 1 to 200
Worksheets(i).Range("c2").Formula = "=Key!B" & i
Next i

My problem comes when I try to do the same with some text boxes that
are in each of the 200 sheets. The 'Shape' object doesn't have a
'formula' method, so I can't figure out how to achieve the same effect
as clicking on the text box and entering the formula into the formula
bar. When I record this, I get the following curious result:

ExecuteExcel4Macro "FORMULA(""=Key!d & i"")"

This is performed on a selection, which is something I was trying to
avoid. If anyone could help me understand what's going on and how to
link the text box, I'd be very grateful!

Thanks again for any help!

G



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formula links in text boxes?

It this is a textbox from the drawing toolbar, then this worked fine for me:

Activesheet.Textboxes("Text Box 13").Formula = "=Sheet1!I9"

--
Regards,
Tom Ogilvy

Gromit wrote in message
...
I'm newly experimenting with VBA, so apologies if this is a stupid
question. Any help much appreciated!

I have a For - Next loop that creates a formula linking a cell in an
'input sheet' ("Key") to a cell in any one of 200 sheets. For cells,
this is no problem, using:

For i = 1 to 200
Worksheets(i).Range("c2").Formula = "=Key!B" & i
Next i

My problem comes when I try to do the same with some text boxes that
are in each of the 200 sheets. The 'Shape' object doesn't have a
'formula' method, so I can't figure out how to achieve the same effect
as clicking on the text box and entering the formula into the formula
bar. When I record this, I get the following curious result:

ExecuteExcel4Macro "FORMULA(""=Key!d & i"")"

This is performed on a selection, which is something I was trying to
avoid. If anyone could help me understand what's going on and how to
link the text box, I'd be very grateful!

Thanks again for any help!

G



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formula links in text boxes?

Hi Tom,

Thanks, your solution worked great. But I don't understand how you
found out about the "Textboxes" object. It's not listed in the MS
online help, the MS VBA help, the Object browser or anywhere else that
I can find! Is there a whole world of similar objects out there that I
don't know about??

Thanks,

Graham



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Formula links in text boxes?

Next time you're in the Object browser:

Rightclick on one of the windows on the right hand side and select Show hidden
members.

You'll find a lot of controls from the forms toolbar there, too.

Gromit wrote:

Hi Tom,

Thanks, your solution worked great. But I don't understand how you
found out about the "Textboxes" object. It's not listed in the MS
online help, the MS VBA help, the Object browser or anywhere else that
I can find! Is there a whole world of similar objects out there that I
don't know about??

Thanks,

Graham

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formula links in text boxes?

You have to select to view hidden objects in the object browser. Their is
no help.

These are the controls that were available in Xl5/xl95 (prior to xl97).
They are still supported, but not documented in the later versions.

--
Regards,
Tom Ogilvy


Gromit wrote in message
...
Hi Tom,

Thanks, your solution worked great. But I don't understand how you
found out about the "Textboxes" object. It's not listed in the MS
online help, the MS VBA help, the Object browser or anywhere else that
I can find! Is there a whole world of similar objects out there that I
don't know about??

Thanks,

Graham



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formula links in text boxes?

Thanks very much Tom and Dave - sudden



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formula links in text boxes?

Thanks Dave and Tom...

Beginning to realize what a curious beast this program is...

Cheers,

Gromit



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

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
User Form Text Boxes - Copy format of text boxes NDBC Excel Discussion (Misc queries) 3 July 2nd 09 02:02 AM
External Links & dialog boxes faureman via OfficeKB.com Excel Discussion (Misc queries) 0 April 8th 08 07:50 PM
Find & Replace Cell Links for Check Boxes Teasee Excel Discussion (Misc queries) 2 May 30th 07 03:30 PM
Changing data links turns combo boxes into images Bill Excel Discussion (Misc queries) 0 October 25th 06 07:39 PM
Formula in text boxes Will Fleenor Excel Worksheet Functions 6 December 9th 04 10:46 PM


All times are GMT +1. The time now is 09:25 AM.

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

About Us

"It's about Microsoft Excel"