ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code-Copy & Paste in Text Boxes (https://www.excelbanter.com/excel-programming/289284-code-copy-paste-text-boxes.html)

Bourbon[_27_]

Code-Copy & Paste in Text Boxes
 
Thanks Jon, I am trying to copy and paste the data in columms A,C and
into each text box that was selected in columm E. (by the code yo
described)Thus, data for example from A1,C2 and D1 will be pasted int
the text box appearing in E1. And so on.... So a code that will do tha
for every text box that is in columm E??

This is a part of my code:
ActiveSheet.Shapes.Range(shape_names).Select
Selection.ShapeRange.ZOrder msoBringToFront
ActiveSheet.Shapes.Range(shape_names).Select
ActiveCell.FormulaR1C1 = "11/3/2000"
ActiveSheet.Shapes.Range(shape_names).Select
Selection.Characters.Text = "11/3/2000" & Chr(10) & ""
With Selection.Characters(Start:=1, Length:=10).Font

But it will not recognize the Text in the second to last line and
guess it will do the same for columms C and D.....

Anyone have any ideas as to how to do this?

Thanks
B

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Code-Copy & Paste in Text Boxes
 
Sub Tester10()
Dim shape_names()
Dim tbox As TextBox
Dim tboxs As TextBoxes
n = 0
ReDim shape_names(0 To 0)
For Each tbox In ActiveSheet.TextBoxes
If tbox.TopLeftCell.Column = 5 Then
ReDim Preserve shape_names(0 To n)
shape_names(n) = tbox.Name
n = n + 1
End If
Next
Set tboxs = ActiveSheet.TextBoxes(shape_names)
tboxs.BringToFront
tboxs.Select
ActiveCell.FormulaR1C1 = "11/3/2000"
For Each tbox In tboxs
tbox.Text = "11/3/2000" & Chr(10) & ""
Next
End Sub


--
Regards,
Tom Ogilvy



Bourbon wrote in message
...
Thanks Jon, I am trying to copy and paste the data in columms A,C and D
into each text box that was selected in columm E. (by the code you
described)Thus, data for example from A1,C2 and D1 will be pasted into
the text box appearing in E1. And so on.... So a code that will do that
for every text box that is in columm E??

This is a part of my code:
ActiveSheet.Shapes.Range(shape_names).Select
Selection.ShapeRange.ZOrder msoBringToFront
ActiveSheet.Shapes.Range(shape_names).Select
ActiveCell.FormulaR1C1 = "11/3/2000"
ActiveSheet.Shapes.Range(shape_names).Select
Selection.Characters.Text = "11/3/2000" & Chr(10) & ""
With Selection.Characters(Start:=1, Length:=10).Font

But it will not recognize the Text in the second to last line and I
guess it will do the same for columms C and D.....

Anyone have any ideas as to how to do this?

Thanks
B.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com