View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jamescox[_102_] jamescox[_102_] is offline
external usenet poster
 
Posts: 1
Default referencing multiple controls using a variable


There may be a better way, but this works.

(Color 'family' generator - the RGB part - thrown in for free :Bgr )

Public Sub dev3()

Dim sName As String
Dim iI As Integer

For iI = 1 To 3
sName = "ListBox" & CStr(iI)
ActiveSheet.OLEObjects(sName).Object.BackColor = RGB(80 * iI,
80 * 11, 80 * (3 - iI))
Next iI

End Sub


--
jamescox
------------------------------------------------------------------------
jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=118933