LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Load Values from Worksheet to Userform Controls with Loop

Does anyone know of a faster way to do this code below? Maybe use a Loop
with an array or collection? I have to do code like this with about 15 other
products. So having a nice loop surely would be more pleasing. This is how
I load all the values into the Userform requested by the user.


Set wksItem = Sheets("Alum Faces")

' find column number of reference number
n = WorksheetFunction.Match(Target, wksItem.Rows("1:1"), 0)

With frmAluminumFaces
.lblRefNumber = Target
.tbxHeightFt = wksItem.Cells(2, n)
.tbxHeightIns = wksItem.Cells(3, n)
.tbxWidthFt = wksItem.Cells(4, n)
.tbxWidthIns = wksItem.Cells(5, n)
.cboFaceMaterial = wksItem.Cells(6, n)
.cboMounting = wksItem.Cells(7, n)
.cboFaceShape = wksItem.Cells(8, n)
.chkPaint = wksItem.Cells(9, n)
.chkTextured = wksItem.Cells(10, n)
.tbxColorsP = wksItem.Cells(11, n)
.spbColorsP = wksItem.Cells(12, n)
.optSimpleP = wksItem.Cells(13, n)
.optComplexP = wksItem.Cells(14, n)
.cboAreaP1 = wksItem.Cells(15, n)
.tbxColorP1 = wksItem.Cells(16, n)
.mpgPaint.Pages(0).Visible = wksItem.Cells(17, n)
.cboAreaP2 = wksItem.Cells(18, n)
.tbxColorP2 = wksItem.Cells(19, n)
.mpgPaint.Pages(1).Visible = wksItem.Cells(20, n)
.cboAreaP3 = wksItem.Cells(21, n)
.tbxColorP3 = wksItem.Cells(22, n)
.mpgPaint.Pages(2).Visible = wksItem.Cells(23, n)
.cboAreaP4 = wksItem.Cells(24, n)
.tbxColorP4 = wksItem.Cells(25, n)
.mpgPaint.Pages(3).Visible = wksItem.Cells(26, n)
.chkVinyl = wksItem.Cells(27, n)
.tbxColorsV = wksItem.Cells(28, n)
.spbColorsV = wksItem.Cells(29, n)
.optSimpleV = wksItem.Cells(30, n)
.optComplexV = wksItem.Cells(31, n)
.cboAreaV1 = wksItem.Cells(32, n)
.tbxColorV1 = wksItem.Cells(33, n)
.mpgVinyl.Pages(0).Visible = wksItem.Cells(34, n)
.cboAreaV2 = wksItem.Cells(35, n)
.tbxColorV2 = wksItem.Cells(36, n)
.mpgVinyl.Pages(1).Visible = wksItem.Cells(37, n)
.cboAreaV3 = wksItem.Cells(38, n)
.tbxColorV3 = wksItem.Cells(39, n)
.mpgVinyl.Pages(2).Visible = wksItem.Cells(40, n)
.cboAreaV4 = wksItem.Cells(41, n)
.tbxColorV4 = wksItem.Cells(42, n)
.mpgVinyl.Pages(3).Visible = wksItem.Cells(43, n)
.chkDigitalPrint = wksItem.Cells(44, n)
.cboAreaD = wksItem.Cells(45, n)
.chkRouted = wksItem.Cells(46, n)
.cboAreaR = wksItem.Cells(47, n)
.cboBackingDeco = wksItem.Cells(48, n)
.tbxCustomItem1 = wksItem.Cells(49, n)
.tbxCustomItem1Cost = wksItem.Cells(50, n)
.tbxCustomItem2 = wksItem.Cells(51, n)
.tbxCustomItem2Cost = wksItem.Cells(52, n)
.chkCrate = wksItem.Cells(53, n)
.tbxCrateH = wksItem.Cells(54, n)
.tbxCrateW = wksItem.Cells(55, n)
.tbxCrateD = wksItem.Cells(56, n)
.tbxCrateQty = wksItem.Cells(57, n)
.tbxCrateCost = wksItem.Cells(58, n)
.tbxQuantity = wksItem.Cells(59, n)
.tbxDiscount = wksItem.Cells(60, n)
.tbxComments = wksItem.Cells(61, n)
End With

Call frmAluminumFaces.cmbCalculate_Click
frmAluminumFaces.Show

Thanks in Advance!
--
Cheers,
Ryan
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Load Userform Control Values from Worksheet RyanH Excel Programming 0 November 12th 08 08:14 PM
Load Userform Values from Sheet with Array & For...Loop RyanH Excel Programming 0 November 12th 08 07:38 PM
Loop through image controls on worksheet Paul Mathews Excel Programming 8 June 21st 08 12:25 PM
Can you load part of a worksheet into a userform Tom Ogilvy Excel Programming 0 April 7th 06 06:30 PM
Loop through objects/controls on worksheet Tom V Excel Programming 2 September 16th 04 06:09 PM


All times are GMT +1. The time now is 09:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"