Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 683
Default Referencing User Form from WorkBook

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
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
Workbook does not Save from User Form Brian Excel Programming 6 January 5th 10 03:06 AM
Can I use VBA to copy User Form from 1 workbook to another? MikeZz Excel Programming 29 September 24th 09 11:36 PM
Active Workbook from User Form Troubled User Excel Programming 1 September 2nd 09 03:08 AM
Filling/referencing cells from User Form Xhawk57 Excel Programming 0 November 12th 08 07:08 PM
Date field in user form & Loading a user form on opening workbook Balan Excel Programming 1 May 24th 08 03:40 PM


All times are GMT +1. The time now is 04:13 PM.

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"