Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Beginer to UserForms question on assigning properties to objects
Newbie to userforms question here.
Setting up a user UserForm for Data entry there are 32 TextBoxes named CAT1BOX, CAT2BOX, CAT3BOX,... CAT32BOX 28 Labels named CAT1, CAT2, CAT3, ... CAT28 I am trying to name and populate them dynamically using the For-Next statement below, but am getting a RunTime error '91 "Object variable or With block variable not set" Private Sub UserForm_Initialize() Dim MyField As Object, MyWork As Object Me.Caption = "WorkFlow Tracking for " & Sheets("Data").Range("B4").Value & _ " For " & Sheets("Data").Range("B3").Value For i = 1 To 32 If i < 29 Then MyField = "CAT" & i MyField.Text = Sheets("data").Range("J17").Offset(-i + 1, 0).Value MyWork = "CAT" & i & "BOX" MyWork.Value = Sheets("data").Range("B12").Offset(0, i - 1).Value Else MyWork = "CAT" & i & "BOX" MyWork.Value = Sheets("data").Range("B12").Offset(0, i - 1).Value End If Next End Sub I know I am not seeing something incrediblly stupid... If anyone knows of an "Idiots guide to using UserForms in Excel" ... |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Beginer to UserForms question on assigning properties to objects
Thank you, that worked. Well it did as soon as I rememberd that down
is negative and changed the "-i +1" to "i-1" so that I wasn't trying to read cells located about six inches above my computer... :) On Jul 26, 7:41 am, Dave Peterson wrote: Just to loop differently (you can change it back!) Dave Peterson- Hide quoted text - - Show quoted text - |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Beginer to UserForms question on assigning properties to objects
Glad you got it working. And found the error. I didn't notice that portion of
your code. wrote: Thank you, that worked. Well it did as soon as I rememberd that down is negative and changed the "-i +1" to "i-1" so that I wasn't trying to read cells located about six inches above my computer... :) On Jul 26, 7:41 am, Dave Peterson wrote: Just to loop differently (you can change it back!) Dave Peterson- Hide quoted text - - Show quoted text - -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with Userforms | Excel Discussion (Misc queries) | |||
I need some help with userforms | Charts and Charting in Excel | |||
Question - How to group unique objects in Excel | Excel Discussion (Misc queries) | |||
Assigning VB to Grouped Objects | Excel Discussion (Misc queries) | |||
UserForms | Excel Discussion (Misc queries) |