LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Text Box help

Nope. That's how the textbox is embedded into the worksheet. Don't change what
appears in that formulabar.

The linkedcell for that textbox is a single cell--not multiple cells.

Don't do this...
You could concatenate the data with all the cells in a range with a formula in
the linked cell:

=a2&" "&a3&" "&a4&" "&a5
(for example)

But then as soon as you type something into the textbox, you'll see that the
formula in the linked cell is gone.



jayklmno wrote:

That code works, but the only thing that's in the box is the Text from the
frst cell of the range. I am still left with the
=EMBED("Forms.TextBox.1",""). Is there a line of code you wrote that is
changing this formula?

"Dave Peterson" wrote:

myPos expects a string--not a formula.

If you want to use a range:

Option Explicit
Sub Macro2()
Dim OLEObj As OLEObject
Dim myAddr As String
Dim myPos As Range
Dim NextRow as long
Dim wks As Worksheet

myAddr = "A1" 'or whatever range name you want

Set wks = ActiveSheet

With wks
'something here that defines NextRow
Nextrow = 12 'whatever.
set myPos = .Cells(NextRow + 1, 2)
with myPos
Set OLEObj = .Parent.OLEObjects.Add(ClassType:="Forms.TextBox.1 ", _
Link:=False, DisplayAsIcon:=False, _
Left:=.Left, Top:=.Top, Width:=.Width, Height:=.Height)

OLEObj.LinkedCell = .Parent.Range(myAddr).Address(external:=True)
end with
End With

End Sub

If you're using a textbox from the Drawing toolbar, you can use the formula
technique. But I thought you wrote you were using the textbox from the control
toolbox toolbar (so don't use that technique--use the linked cell.)

jayklmno wrote:

Yes,

myAddr = "Liq_Table"
myPos = "Cells(NextRow + 1, 2)"

When I run it this way, I get a Run-time error '1004': "Method 'Range' of
object'_Worksheet' failed" here...

With wks.Range(myPos)

"Dave Peterson" wrote:

Did you try changing the linked cell so that it points at that range.

myAddr = "A1"
becomes
myAddr = "liq_table"



jayklmno wrote:

Both of these solutions work to create the text box where I want it, but in
order for me to have the box pull in the correct range, in this case a
formatted table,
I need to change the formula linked to the object...

which is normally
=EMBED("Forms.TextBox.1","")

to
=Liq_Table

The problem seems to be in the recorded code, once the object is created and
selected, Selection.Formula = "=Liq_Table" doesn't work.

Any suggestions?

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


 
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
Using TEXT and &TEXT - display numbers with commas, underline text Gary Excel Discussion (Misc queries) 3 May 5th 23 03:46 AM
Text does not display in "Text boxs" and when wrapping text in a c Esteban Excel Discussion (Misc queries) 1 March 8th 07 11:59 PM
select text in cell based on text from another cell, paste the text at the begining of a thrid cell, etc... jsd219 Excel Programming 0 October 19th 06 05:04 PM
Excel VBA: Worksheet cell .Text property: 1024 bytes text len limit loyso Excel Programming 7 May 3rd 05 02:51 PM
extracting text from within a cell - 'text to rows@ equivalent of 'text to columns' Dan E[_2_] Excel Programming 4 July 30th 03 06:43 PM


All times are GMT +1. The time now is 04:07 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"