Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My application needs copying text box contents (eg.text box 1) from sheet 1
to antoher text box in sheet 2. For that i tried to select text box but i found it is not possible. What is the code for this task? (The text box is ordinary text box and not the text box from active control or form control) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Do you mean a textbox from the drawing toolbar? Try Activesheet.shapes.count, this should return the number of shapes in the worksheet. Next, you can get the names of the shapes with activesheet.shapes(x).name with x is a number between 1 and the result of the .count instruction. To select: activesheet.shapes(x).select With selection.characters.text you can read or set the text. Something as Sub AAAA Dim str As String With ActiveSheet .Shapes("Text Box 3").Select str = Selection.Characters.Text .Shapes("Text Box 2").Select Selection.Characters.Text = str End With End Sub should do what you want. Wkr, JP "ezil" wrote in message ... My application needs copying text box contents (eg.text box 1) from sheet 1 to antoher text box in sheet 2. For that i tried to select text box but i found it is not possible. What is the code for this task? (The text box is ordinary text box and not the text box from active control or form control) |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try it like this...
Worksheets("Sheet2").TextBoxes("Text Box 1").Text = _ Worksheets("Sheet1").TextBoxes("Text Box 1").Text where you would use the appropriate worksheet names in place of my "Sheet1" and "Sheet2" example names and the appropriate Text Box names in place of my example "Text Box 1" and "Text Box 2". -- Rick (MVP - Excel) "ezil" wrote in message ... My application needs copying text box contents (eg.text box 1) from sheet 1 to antoher text box in sheet 2. For that i tried to select text box but i found it is not possible. What is the code for this task? (The text box is ordinary text box and not the text box from active control or form control) |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
By the way, if you are unsure of how to get the names Excel assigns to its
Shape objects (whether they be Text Boxes or any other shape object), simply select the shape object and then execute this statement in the VB editor's Immediate window... ? Selection.Name -- Rick (MVP - Excel) "Rick Rothstein" wrote in message ... Try it like this... Worksheets("Sheet2").TextBoxes("Text Box 1").Text = _ Worksheets("Sheet1").TextBoxes("Text Box 1").Text where you would use the appropriate worksheet names in place of my "Sheet1" and "Sheet2" example names and the appropriate Text Box names in place of my example "Text Box 1" and "Text Box 2". -- Rick (MVP - Excel) "ezil" wrote in message ... My application needs copying text box contents (eg.text box 1) from sheet 1 to antoher text box in sheet 2. For that i tried to select text box but i found it is not possible. What is the code for this task? (The text box is ordinary text box and not the text box from active control or form control) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
select text in cell based on text from another cell, paste the text at the begining of a thrid cell, etc... | Excel Programming | |||
Text desappears when I select wrap text | Excel Discussion (Misc queries) | |||
Select text from a field | Excel Programming | |||
Select Text in TextBox | Excel Programming | |||
Select Case with Text | Excel Programming |