Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy text to the Text Box


Another newbie question:

I can't figure out how to copy text from a particular cell on Sheet1
and paste it into my text box, everything I've tried hasn’t worked. The
idea is so the user can edit the text without having to retype it.

I can copy text from the text box but cannot retrieve it, here's what I
have so far.


Private Sub cmdSave_Click()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Worksheets("Names Birth Dates")
Set ws2 = Worksheets("BDS Under Construction")

'Retrieve text from the correct cell location.

'copy text back to the same cell location.
ws1.Cells((ws2.Cells(2, 87)) - 3, 3) = Me.BdayText.Value

End Sub


Any comments are greatly appreciated.

Matt


--
Flintstone
------------------------------------------------------------------------
Flintstone's Profile: http://www.excelforum.com/member.php...o&userid=15310
View this thread: http://www.excelforum.com/showthread...hreadid=552797

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Copy text to the Text Box

Flintstone wrote:
Another newbie question:

I can't figure out how to copy text from a particular cell on Sheet1
and paste it into my text box, everything I've tried hasn't worked.


Hi Matt,

There's not enough info for me to be specific, however, if I had a Text
Box on Sheet2 (Excel has given it the name "Text Box 1") and I wanted
it to show the contents of Sheet1 A1 then I would use the following...

Sheet2.Shapes("Text Box 1").TextFrame.Characters.Text = Sheet1.Cells(1,
1).Value

Does this help?

Ken Johnson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Copy text to the Text Box

Ken:

Saw your post, thought I'd give it a try (to better learn things...)
First of all I thought it would be (based on your narrative explanation:

Sheet1.Cells(1,1).Value =
Sheet2.Shapes("TextBox1).TextFrame.Characters.Text

Also assumed textbox was created using the Control Toolbox;

Anyway - it doesn't work - Here is my code:

Sub Doit()
Sheet1.Cells(1, 1).Value =
Sheet2.Shapes("TextBox1").TextFrame.Characters.Tex t
End Sub

Any thouhts?

TIA,

Jim



"Ken Johnson" wrote in message
oups.com:

Flintstone wrote:

Another newbie question:

I can't figure out how to copy text from a particular cell on Sheet1
and paste it into my text box, everything I've tried hasn't worked.



Hi Matt,

There's not enough info for me to be specific, however, if I had a Text
Box on Sheet2 (Excel has given it the name "Text Box 1") and I wanted
it to show the contents of Sheet1 A1 then I would use the following...

Sheet2.Shapes("Text Box 1").TextFrame.Characters.Text = Sheet1.Cells(1,
1).Value

Does this help?

Ken Johnson


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Copy text to the Text Box

JimMay wrote:
Ken:

Saw your post, thought I'd give it a try (to better learn things...)
First of all I thought it would be (based on your narrative explanation:

Sheet1.Cells(1,1).Value =
Sheet2.Shapes("TextBox1).TextFrame.Characters.Text

Also assumed textbox was created using the Control Toolbox;

Anyway - it doesn't work - Here is my code:

Sub Doit()
Sheet1.Cells(1, 1).Value =
Sheet2.Shapes("TextBox1").TextFrame.Characters.Tex t
End Sub

Any thouhts?


Hi Jim,

I just used a standard TextBox. I steer clear of the Control Toolbox, I
mostly want my stuff to work on PC and Mac, the school I teach at has
both on the network. I'm not sure though whether that has anything to
do with it.

Also, there are typos in
Sheet2.Shapes("TextBox1).TextFrame.Characters.Text

It should read...

Sheet2.Shapes("Text Box 1").TextFrame.Characters.Text

ie, 2 missing spaces and a "

Could it be that perhaps?

I changed my code to do what yours does, which is transfer data from
Text Box to Sheet1 A1, rather than the other way around and it worked
OK (after I included the two missing spaces).

Ken Johnson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy text to the Text Box


Thanks guys, but I've find a different solution by using the Propertie
window, instead of code I typed this into the ControlSource of the tex
box.

=INDIRECT("'Names Birth Dates'!"&CH2&CI2-3)

CH2 is the column letter and CI2 is the row number; works like a charm
However, for the sake of learning I'll have to try it your way.

Again thanks.

Mat

--
Flintston
-----------------------------------------------------------------------
Flintstone's Profile: http://www.excelforum.com/member.php...fo&userid=1531
View this thread: http://www.excelforum.com/showthread.php?threadid=55279

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
text box insert in Excel - text box lines print on second copy Diana (Berry & Co) Excel Discussion (Misc queries) 0 July 26th 06 04:39 AM
Copy text from Ms Access record to Excel text box [email protected] Excel Programming 0 September 7th 05 05:27 PM
I want to link, not just copy,Word source text to a text box in Ex Carrie K Excel Worksheet Functions 0 August 12th 05 07:58 PM
Search for text, copy the number in front of text w0cyru01 Excel Programming 4 August 3rd 05 05:15 PM
open some txt files ,find text , copy the text before that to a single cell gus Excel Programming 2 July 11th 05 05:40 PM


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