Home |
Search |
Today's Posts |
#21
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just a warning...
As a user, I would appreciate the cancel button (or learn to use the X on the title bar). There are lots of times where I've started something in error--or had to go do something (find the value elsewhere (maybe copy|paste from some other location in excel) or just go to a meeting). I'd want a way to dismiss that dialog. And some code that may help: Option Explicit Private Sub CommandButton1_Click() ActiveCell.Value = Replace(Trim(Me.TextBox1.Text), vbNewLine, vbLf) Unload Me End Sub Private Sub CommandButton2_Click() Unload Me End Sub Private Sub TextBox1_Change() Me.CommandButton1.Enabled _ = CBool(Len(Trim(Me.TextBox1.Text)) 0) End Sub Private Sub UserForm_Initialize() Me.Caption = "Enter a value" With Me.Label1 .Caption = "Please enter a value for: " _ & ActiveCell.Address(0, 0) .ForeColor = vbRed End With With Me.CommandButton1 .Caption = "Ok" .Default = True .Enabled = False End With With Me.CommandButton2 .Caption = "Cancel" .Cancel = True .TakeFocusOnClick = False End With With Me.TextBox1 .EnterKeyBehavior = True .MultiLine = True End With End Sub Jim McCaffrey wrote: Dave - please ignore my last post. I have too many things going on and I wasn't completing the UserForm. I added the label and it works fine. I removed the Cancel button because I want the user to enter something in the field. I need to add word wrap to the UserForm and I should be set. Thank you. *** Sent via Developersdex http://www.developersdex.com *** -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF and ISBLANK | Excel Worksheet Functions | |||
ISBLANK() | Excel Worksheet Functions | |||
ISBLANK | Excel Worksheet Functions | |||
IF(ISBLANK) | Excel Worksheet Functions | |||
Isblank Code | Excel Programming |