![]() |
Passing, Declaring, and Assigning Objects
I solved my own problem. I don't know how efficient it is but this is doing what I need wit fewer lines of code. Thanks to anyone who looked and tried to find a solution. Tim ------------------------------------------------------------------------------------------------------ Private Sub UserForm_Initialize() 'load sheet data Call PopulateObjArrays Dim i As Integer Dim strName As String Dim db As String Dim cell As String Dim ctl As Control 'load ID's For i = 0 To DIM_ROW_COUNT - 1 Step 1 strName = "lbl" + DimArray(i, 0) + "ID" Set ctl = AllInputs.Controls.Item(strName) db = DimArray(i, 1) cell = "A" + DimArray(i, 2) Call modFormUpdate.sendCellToLabel(ctl, db, cell) Next i End Sub -------------------------------------------------------------------------------------------------- 'Takes the contents of a Cell and places in in the designated Label Function sendCellToLabel(ByRef Lbl As Control, ByRef SheetName As String, ByRef CellName As String) Lbl.Caption = Worksheets(SheetName).Range(CellName) End Functio -- tfran ----------------------------------------------------------------------- tfrank's Profile: http://www.excelforum.com/member.php...fo&userid=1588 View this thread: http://www.excelforum.com/showthread.php?threadid=27372 |
All times are GMT +1. The time now is 05:52 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com