Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry it wa smy Bad. I was missing and = sign between the work Book & Userform.
I have another question I am going to post if you would please look for it. It has to do with Combo Boxes & Worksheets. Thanks "JLGWhiz" wrote: I am trying to get my head straight on what you are showing. 1. I believe you said you were going to put a hidden sheet in each job workbook. Did you do that? 2. Is the hidden sheet named "Job Data" in each of the job workbooks? 3. Is the data stored in the same range of cells in each hidden sheet? If so what are the cell addresses for the range? Before answering these questions, read on. I assumed that the answer is yes for the first two and that the ranges are those you show in the posted code. Again, the UserForm loses all values when the form is Unloaded, so the data must be stored prior to unloading the form and closing the workbook containing the form. Conversely, nothing can be added to the form until the form is initialized during the Load or Show method. So, the workbook containing the form must be open and the form must be initialized before any of the stored data can be recovered and populated into the controls on the form. You probably were aware of the above, but I want to make sure the bases are covered as we go through this. This is the part that confuses me. Your posting says this is the code to recover the data from the hidden sheet: With UserForm1 ' Site Information: UserForm1("CLLI_Code_1").Value = .Range("D02").Value UserForm1("Office_1").Value = .Range("D03").Value UserForm1("Address_11").Value = .Range("D04").Value UserForm1("Address_12").Value = .Range("D05").Value More Code for all the Text Boxes (Lines 02-45) ' Line 46 Me("Type_Work_723").Value = .Range("C83").Value Me("Bay_Description_723").Value = .Range("J83").Value Me("Bay_ID_723").Value = .Range("F83").Value Me("Description_Work_723").Value = .Range("M83").Value '================================================= ==== End With What I do not see in this code is a reference to the sheet "Job Data" or the workbook that it is in. Assuming the Object Variable bk is the job workbook that was opened by a user and the ranges referenced above are, in fact, on sheet Job Data, then I would write the code like this: With bk.Sheets("Job Data") ' Site Information: UserForm1("CLLI_Code_1").Value = .Range("D02").Value UserForm1("Office_1").Value = .Range("D03").Value UserForm1("Address_11").Value = .Range("D04").Value UserForm1("Address_12").Value = .Range("D05").Value 'More Code for all the Text Boxes (Lines 02-45) ' Line 46 Me("Type_Work_723").Value = .Range("C83").Value Me("Bay_Description_723").Value = .Range("J83").Value Me("Bay_ID_723").Value = .Range("F83").Value Me("Description_Work_723").Value = .Range("M83").Value End With If you get an error with this, you might need to use the form name instead of Me. Although Me should work since you are running the code from the form module. "Brian" wrote in message ... Very nice to hear from you. I am so glad your helping me with this. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Workbook does not Save from User Form | Excel Programming | |||
Can I use VBA to copy User Form from 1 workbook to another? | Excel Programming | |||
Active Workbook from User Form | Excel Programming | |||
Filling/referencing cells from User Form | Excel Programming | |||
Date field in user form & Loading a user form on opening workbook | Excel Programming |