Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop through Textboxes in Excel

Status
Not open for further replies.

fredka

Technical User
Jul 25, 2006
114
US
I have a sheet with a map on it ... on the map, I have several textboxes that point to values in another sheet.

I added a combo box (cbodtapoint) that I want to use to alternate what data displays in the text boxes.

I have that part working but after the update, the formatting of the textboxes go back to the default. For example, I have white letters with weight of 8.

Is there a way to have the formatting not change? Here is my code in an attempt to get the look back after I make the updates... (for some reason, it fixes the formatting on datawarren but not datasussex... thanks!!!!

Private Sub cboDataPoint_Change()
If Me.cboDataPoint = "Value" Then

ActiveSheet.Shapes("DataSussex").Select
Selection.Formula = "Data!c22"
ActiveSheet.Shapes("DataWarren").Select
Selection.Formula = "Data!c24"
Else

ActiveSheet.Shapes("DataSussex").Select
Selection.Formula = "Data!D22"
ActiveSheet.Shapes("DataWarren").Select
Selection.Formula = "Data!D24"

End If


Dim shp As Shape
Dim sLoc As String

For Each shp In ActiveSheet.Shapes

With shp

If Left(.Name, 4) = "Data" Then
MsgBox shp.Name
Selection.Font.ColorIndex = 2
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Selection.Font.Bold = True
End If
End With
Next shp
ENd Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top