LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Defining UserForm Caption from a Variable

In the example nbelow the userform is opened using the workbook open event
and the userform is called with whatever caption is type in cel 1,1 of sheet
1.


Private Sub Workbook_Open()

UserForm1.Caption = Worksheets("Sheet1").Cells(1, 1).Text
UserForm1.Show

End Sub

Mike


" wrote:

Hello all mighty Excel gurus!

I was wondering if it's possible to pass a variable in when showing a
userform to set the caption. I have made UserForm1 and based on a
variable set earlier in the macro I want to be able to assign a
"caption". Obviously I can set it in the Properties by clicking the
Caption setting and typing anything I want. But can I do something
like this (and pardon the "fantasy" code):

Dim FormName as String
FormName = Range("A1").Value

UserForm.show Caption:=FormName

Is something like that possible? Can I send in a predefined variable
to set the caption on the fly when it opens (shows) the UserForm?

Thanks!
Steve


 
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 background was dotted, now plain? dk_ Excel Discussion (Misc queries) 0 November 6th 06 01:53 AM
Aling multiple sets of data by header column MarkusO Excel Discussion (Misc queries) 2 April 12th 06 07:29 PM
Defining "Month" as a variable in VBA Colin Vicary Excel Discussion (Misc queries) 2 February 22nd 06 05:58 PM
Userform button setting variable from formula teepee Excel Discussion (Misc queries) 4 January 4th 06 06:59 PM
Userform button setting variable from formula teepee Excel Discussion (Misc queries) 0 January 3rd 06 08:26 PM


All times are GMT +1. The time now is 05:41 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"