View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tfrank tfrank is offline
external usenet poster
 
Posts: 1
Default 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