Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default clear captions from all labels

i have a sheet with over 100 labels on it. i need a statement that will set
all of their captions to blank. this is what i have, but it is not working.
can someone help

For Each Label in Sheets("PickSheet").Labels
Label.Caption = ""
Next

how can i rephrase this to make it work. TIA.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default clear captions from all labels

Sub test()
Dim shp As Shape

For Each shp In ActiveSheet.Shapes
If shp.Type = msoFormControl Then
If shp.FormControlType = xlLabel Then
shp.TextFrame.Characters.Text = ""
End If
End If
Next
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Spencer Hutton" wrote in message
m...
i have a sheet with over 100 labels on it. i need a statement that will
set all of their captions to blank. this is what i have, but it is not
working. can someone help

For Each Label in Sheets("PickSheet").Labels
Label.Caption = ""
Next

how can i rephrase this to make it work. TIA.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default clear captions from all labels

that did not work, i copied the code exactly except i changed active sheet
to ("PickSheet") i did try it as ActiveSheet in the code for that sheet nd
it still did not work. protection is off, and ti tried it in design mode as
well as not.
"Rob van Gelder" wrote in message
...
Sub test()
Dim shp As Shape

For Each shp In ActiveSheet.Shapes
If shp.Type = msoFormControl Then
If shp.FormControlType = xlLabel Then
shp.TextFrame.Characters.Text = ""
End If
End If
Next
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Spencer Hutton" wrote in message
m...
i have a sheet with over 100 labels on it. i need a statement that will
set all of their captions to blank. this is what i have, but it is not
working. can someone help

For Each Label in Sheets("PickSheet").Labels
Label.Caption = ""
Next

how can i rephrase this to make it work. TIA.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default clear captions from all labels

You didn't specify if your Labels are from the Forms or Controls toolbox
menu. But have a go with this:

Sub LabelsText()
Dim str As String
str = "Some text"
'str = ""

'Forms menu
'On Error Resume Next 'in case no labels on sheet
ActiveSheet.Labels.Text = str
On Error GoTo 0

'Controls toolbox
Dim ob As Object
For Each ob In ActiveSheet.OLEObjects
If TypeName(ob.Object) = "Label" Then
ob.Object.Caption = str
End If
Next
End Sub

Regards,
Peter

"Spencer Hutton" wrote in message
m...
i have a sheet with over 100 labels on it. i need a statement that will

set
all of their captions to blank. this is what i have, but it is not

working.
can someone help

For Each Label in Sheets("PickSheet").Labels
Label.Caption = ""
Next

how can i rephrase this to make it work. TIA.




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
X axis captions Stefi Charts and Charting in Excel 6 September 11th 08 01:16 PM
Cell values as captions TUNGANA KURMA RAJU Excel Discussion (Misc queries) 1 July 24th 06 12:29 PM
How do I put captions on Excel charts? pgrizzell Charts and Charting in Excel 1 June 8th 06 10:14 PM
reset menu captions T Excel Programming 2 November 12th 04 11:28 AM
Clear Textboxes, Labels, and Checkboxes milo[_2_] Excel Programming 1 October 16th 03 09:21 PM


All times are GMT +1. The time now is 06:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"