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

Hi,
I'm trying to automatically open a Form when a target cell contains an exact
text.

Example:
IF cell A1 says: "Oranges"
THEN
Open Form1.

I've only opened Forms using command buttons.
I was thinking maybe using Sub Worksheet_Change to do this?

If cell A1 says anything else, (false) Do not open Form1.

Thank-you in advance
Amy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Worksheet_Change?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
If IsNumeric(Target.Value) And Target.Value 200 Then
UserForm1.Show
End If
End If
End Sub

Let's say the value in cell A1 is 200; UserForm1 pops open.
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"spreadsheetlady" wrote:

Hi,
I'm trying to automatically open a Form when a target cell contains an exact
text.

Example:
IF cell A1 says: "Oranges"
THEN
Open Form1.

I've only opened Forms using command buttons.
I was thinking maybe using Sub Worksheet_Change to do this?

If cell A1 says anything else, (false) Do not open Form1.

Thank-you in advance
Amy

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Worksheet_Change?

Hi,

Maybe this

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
If UCase(Target) = "ORANGES" Then
Application.EnableEvents = False

UserForm1.Show
Application.EnableEvents = True
End If
End If
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"spreadsheetlady" wrote:

Hi,
I'm trying to automatically open a Form when a target cell contains an exact
text.

Example:
IF cell A1 says: "Oranges"
THEN
Open Form1.

I've only opened Forms using command buttons.
I was thinking maybe using Sub Worksheet_Change to do this?

If cell A1 says anything else, (false) Do not open Form1.

Thank-you in advance
Amy

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Worksheet_Change?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
If .Value = "Oranges" Then
UserForm1.Show
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

On Fri, 28 May 2010 07:29:02 -0700, spreadsheetlady
wrote:

Hi,
I'm trying to automatically open a Form when a target cell contains an exact
text.

Example:
IF cell A1 says: "Oranges"
THEN
Open Form1.

I've only opened Forms using command buttons.
I was thinking maybe using Sub Worksheet_Change to do this?

If cell A1 says anything else, (false) Do not open Form1.

Thank-you in advance
Amy


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
Worksheet_Change help Ayo Excel Programming 6 April 29th 09 03:30 AM
Worksheet_Change General Specific Excel Programming 5 June 24th 08 05:20 PM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


All times are GMT +1. The time now is 04:29 PM.

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"