ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA - Text Boxes (https://www.excelbanter.com/excel-programming/309120-excel-vba-text-boxes.html)

KD[_3_]

Excel VBA - Text Boxes
 
Hi,

I am trying to copy all the contents of some text boxes
that appear on a worksheet on to a seperate worksheet but
without much luck.

I am trying to use a for each loop but cannot get it to
work when I need it to refernece the text boxes
individually.

Can anyone help me?

Many thanks
KD

Tom Ogilvy

Excel VBA - Text Boxes
 
for ActiveX textboxes

dim tbox as MSforms.Textbox
dim obj as OleObject
for each obj in Activesheet.OleObjects
if typeof obj.Object is MSforms.Textbox then
set tbox = obj.Object
' now work with your textbox
end if
Next

for Textboxes from the drawing toolbar

dim tbox as Textbox
for each tbox in Activesheet.Textboxes
' now work with your textboxes
Next

--
Regards,
Tom Ogilvy


"KD" wrote in message
...
Hi,

I am trying to copy all the contents of some text boxes
that appear on a worksheet on to a seperate worksheet but
without much luck.

I am trying to use a for each loop but cannot get it to
work when I need it to refernece the text boxes
individually.

Can anyone help me?

Many thanks
KD





All times are GMT +1. The time now is 05:19 PM.

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