Excel VBA - Text Boxes

K

KD

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
 
T

Tom Ogilvy

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
 
Top