Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default if cell is greater than "" then run macro

I'm trying to create a macro that will open a Userform. The requirement
would be, is if the end user enters any data in Cell L12 then the form would
open up, if that cell is blank then nothing would happen. The Data Value
would be Numerical or Text. I know this is a worksheet_change but not quite
sure what the proper coding is. Any help is appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default if cell is greater than "" then run macro

You'll need to use an event macro. Put this in the worksheet code module
(assuming a userform class named MyForm):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim frmUser As MyForm
With Target
If .Address(False, False) = "L12" Then
If Not IsEmpty(.Value) Then
Set frmUser = New MyForm
frmUser.Show
End If
End If
End With
End Sub




In article ,
"Brad" wrote:

I'm trying to create a macro that will open a Userform. The requirement
would be, is if the end user enters any data in Cell L12 then the form would
open up, if that cell is blank then nothing would happen. The Data Value
would be Numerical or Text. I know this is a worksheet_change but not quite
sure what the proper coding is. Any help is appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default if cell is greater than "" then run macro

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = "$L$12" And Target.Value < "" Then
UserForm1.Show
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Brad" wrote in message
...
I'm trying to create a macro that will open a Userform. The requirement
would be, is if the end user enters any data in Cell L12 then the form

would
open up, if that cell is blank then nothing would happen. The Data Value
would be Numerical or Text. I know this is a worksheet_change but not

quite
sure what the proper coding is. Any help is appreciated.



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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! [email protected] Excel Discussion (Misc queries) 3 January 5th 07 02:18 PM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
sort data rows "greater than or equal" criteria in another cell HV man Excel Worksheet Functions 0 March 26th 06 11:50 PM
Complex if test program possible? If "value" "value", paste "value" in another cell? jseabold Excel Discussion (Misc queries) 1 January 30th 06 10:01 PM


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