ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   referencing multiple controls using a variable (https://www.excelbanter.com/excel-programming/431555-re-referencing-multiple-controls-using-variable.html)

jamescox[_102_]

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



All times are GMT +1. The time now is 01:26 PM.

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