LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #21   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default IsBlank() in VBA code?

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
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
IF and ISBLANK projectnewbie Excel Worksheet Functions 4 July 30th 08 05:41 PM
ISBLANK() kw_uh97 Excel Worksheet Functions 8 June 30th 07 06:42 AM
ISBLANK Gimpy815 Excel Worksheet Functions 2 February 24th 06 06:09 PM
IF(ISBLANK) Bill R Excel Worksheet Functions 4 August 13th 05 07:43 PM
Isblank Code Greg B... Excel Programming 2 February 28th 05 09:47 AM


All times are GMT +1. The time now is 07:35 AM.

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"