Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Userform Question

I have a spreadsheet where I have multiple userforms. On the top of most of these userforms is a summary section that is always the same (includes names, date, and other attributes). Right now, whenever I create a userform I have to add this section and the necessary code for it to work properly. Is there a way to just create the summary section once and then use simple code to add it to the userforms

The way the summary works is that it pulls the name from another worksheet. The user will click on a button on the worksheet and it will pull up the appropriate userform with the summary section at the top. As it is, I have to write code for the button to populate the name,etc fields in the summary section. Here is a copy of the code that I use on the button to bring up the userform
Private Sub CommandButton2_Click(
'This is The Lock Butto
UserForm13RecaptureLock.Label5.Caption = Sheets("Main").Range("A2").Tex
UserForm13RecaptureLock.Label6.Caption = Sheets("Main").Range("B2").Tex
UserForm13RecaptureLock.Label7.Caption = Sheets("Main").Range("C2").Tex
UserForm13RecaptureLock.Label8.Caption = Sheets("Main").Range("W2").Tex
UserForm13RecaptureLock.Sho

I am really concerned about the size of the file building up since I have to use this code everytime I create a userform with the summary section. I know there has to be a better way...please someone help me figure it out

Rya

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Userform Question

Couldn't you use one userform with a multipage control.
You can hide the tabs in the properties and specify which
one is shown as they are indexed.
-----Original Message-----
I have a spreadsheet where I have multiple userforms. On

the top of most of these userforms is a summary section
that is always the same (includes names, date, and other
attributes). Right now, whenever I create a userform I
have to add this section and the necessary code for it to
work properly. Is there a way to just create the summary
section once and then use simple code to add it to the
userforms?

The way the summary works is that it pulls the name from

another worksheet. The user will click on a button on the
worksheet and it will pull up the appropriate userform
with the summary section at the top. As it is, I have to
write code for the button to populate the name,etc fields
in the summary section. Here is a copy of the code that I
use on the button to bring up the userform:
Private Sub CommandButton2_Click()
'This is The Lock Button
UserForm13RecaptureLock.Label5.Caption = Sheets

("Main").Range("A2").Text
UserForm13RecaptureLock.Label6.Caption = Sheets

("Main").Range("B2").Text
UserForm13RecaptureLock.Label7.Caption = Sheets

("Main").Range("C2").Text
UserForm13RecaptureLock.Label8.Caption = Sheets

("Main").Range("W2").Text
UserForm13RecaptureLock.Show

I am really concerned about the size of the file building

up since I have to use this code everytime I create a
userform with the summary section. I know there has to be
a better way...please someone help me figure it out.

Ryan

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Userform Question

Say you have 5 forms that are really similar. You could put the common elements
on the top of the form and then use a multipage control on the bottom.

Each page would be used to retrieve some set of parms from the user.

I created a test userform with a label at the top of the form. Then I added a
multipage control to the bottom portion.

Then I added a few pages (right click on a page tab and choose add).

Then I used this code to test it:

Option Explicit
Private Sub UserForm_Initialize()

Dim myVal As Long
Dim iCtr As Long

'decide which one to show
myVal = 2

With Me.MultiPage1
.Style = fmTabStyleNone

For iCtr = 0 To .Pages.Count - 1
.Pages(iCtr).Visible = CBool(iCtr = myVal)
Next iCtr
End With

End Sub

The .style setting hides all the stuff you don't want the user to see (stuff for
other forms).



Ryan wrote:

Dennis,

I'm sorry I am still pretty new to VBA and am having trouble understanding what you are saying. Can you please break it down further for me?

Ryan


--

Dave Peterson

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
Userform question Brad Excel Discussion (Misc queries) 4 March 15th 10 04:43 PM
UserForm Question Mr BT[_3_] Excel Worksheet Functions 0 August 20th 07 04:56 AM
UserForm question Doug[_9_] Excel Programming 1 January 1st 04 10:05 PM
userform question Rob Bovey Excel Programming 0 August 25th 03 11:43 PM
userform question David Goodall Excel Programming 0 August 25th 03 07:10 PM


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

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

About Us

"It's about Microsoft Excel"