Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
BJ BJ is offline
external usenet poster
 
Posts: 51
Default WorkSheet Change Event - Need Help With Coding Syntax

1. User selects OptionButton1 (New) or OptionButton2 (Renew)
2. User inputs volumes of one to three products
3. Need to turn on the appropriate OptionButton (NewProd1, NewProd2, etc.)

Here is my code:

Private Sub Worksheet_Change(ByVal Target As Range)
With Worksheets("Input")
If Not Intersect(Target, .Range("FROI_Vol")) Is Nothing Then
If .Range("FROI_Vol").Value < 0 Then
If NewProduct.Value = True Then
FROI.Value = True And FROI_Renew.Value = False
Else
FROI.Value = False And FROI_Renew.Value = True
End If
End If
End If
End With
End Sub

I can get the OptionButtons for the 'New' products to turn on, but the
OptionButtons for the 'Renew' products aren't turning on so maybe I'm not
using the ELSE statement appropriately?

Any help appreciated.

BJ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default WorkSheet Change Event - Need Help With Coding Syntax

I've not used option buttons at all, but I'll give it a try

Private Sub Worksheet_Change(ByVal Target As Range)
With Worksheets("Input") 'If the worksheet that's changing is Input,
' you can use "With ME"
If Not Intersect(Target, .Range("FROI_Vol")) Is Nothing Then
If .Range("FROI_Vol").Value < 0 Then
If NewProduct.Value = True Then
FROI.Value = True
FROI_Renew.Value = False 'do you need this.
'If I set one Option
Button to True
'The others change to false
Else
FROI.Value = False
FROI_Renew.Value = True
End If
End If
End If
End With
End Sub

--
HTH,
Barb Reinhardt




"BJ" wrote:

1. User selects OptionButton1 (New) or OptionButton2 (Renew)
2. User inputs volumes of one to three products
3. Need to turn on the appropriate OptionButton (NewProd1, NewProd2, etc.)

Here is my code:

Private Sub Worksheet_Change(ByVal Target As Range)
With Worksheets("Input")
If Not Intersect(Target, .Range("FROI_Vol")) Is Nothing Then
If .Range("FROI_Vol").Value < 0 Then
If NewProduct.Value = True Then
FROI.Value = True And FROI_Renew.Value = False
Else
FROI.Value = False And FROI_Renew.Value = True
End If
End If
End If
End With
End Sub

I can get the OptionButtons for the 'New' products to turn on, but the
OptionButtons for the 'Renew' products aren't turning on so maybe I'm not
using the ELSE statement appropriately?

Any help appreciated.

BJ

  #3   Report Post  
Posted to microsoft.public.excel.programming
BJ BJ is offline
external usenet poster
 
Posts: 51
Default WorkSheet Change Event - Need Help With Coding Syntax

Thanks Barb - works perfectly!

"Barb Reinhardt" wrote:

I've not used option buttons at all, but I'll give it a try

Private Sub Worksheet_Change(ByVal Target As Range)
With Worksheets("Input") 'If the worksheet that's changing is Input,
' you can use "With ME"
If Not Intersect(Target, .Range("FROI_Vol")) Is Nothing Then
If .Range("FROI_Vol").Value < 0 Then
If NewProduct.Value = True Then
FROI.Value = True
FROI_Renew.Value = False 'do you need this.
'If I set one Option
Button to True
'The others change to false
Else
FROI.Value = False
FROI_Renew.Value = True
End If
End If
End If
End With
End Sub

--
HTH,
Barb Reinhardt




"BJ" wrote:

1. User selects OptionButton1 (New) or OptionButton2 (Renew)
2. User inputs volumes of one to three products
3. Need to turn on the appropriate OptionButton (NewProd1, NewProd2, etc.)

Here is my code:

Private Sub Worksheet_Change(ByVal Target As Range)
With Worksheets("Input")
If Not Intersect(Target, .Range("FROI_Vol")) Is Nothing Then
If .Range("FROI_Vol").Value < 0 Then
If NewProduct.Value = True Then
FROI.Value = True And FROI_Renew.Value = False
Else
FROI.Value = False And FROI_Renew.Value = True
End If
End If
End If
End With
End Sub

I can get the OptionButtons for the 'New' products to turn on, but the
OptionButtons for the 'Renew' products aren't turning on so maybe I'm not
using the ELSE statement appropriately?

Any help appreciated.

BJ

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
Cell value change to trigger macro (worksheet change event?) Neil Goldwasser Excel Programming 4 January 10th 06 01:55 PM
Worksheet change event I think? Big H Excel Programming 1 November 18th 05 08:24 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM
Worksheet Change Event Eva Shanley[_2_] Excel Programming 1 September 17th 04 11:07 PM


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