LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
jrh jrh is offline
external usenet poster
 
Posts: 14
Default Userform not working

Hi.
I have a template spreadsheet with quarterly calculations
(formulas). I want to create a userform for the person to
click which quarter is the most current and then hit
enter. Based on the user's response, I want the macro to
replace the formulas for quarters that haven't happened
yet with zero values thus turning off the calculation.

I have made a userform with 5 radio buttons to click for
which quarter is the most recent. Choices are either
None, 1, 2, 3, or 4. However, the macro is replacing
every quarter's formula with a zero no matter which radio
button the user clicks. Can you help me figure out what
is wrong?

'Here is the procedure for when the enter button is hit on
the userform:

Public Sub Sales_User_Form_Enter_Button_Click()
If NoneButton Then CurrentQuarterlyKicker = None
If FirstQuarterButton Then CurrentQuarterlyKicker = 1
If SecondQuarterButton Then CurrentQuarterlyKicker = 2
If ThirdQuarterButton Then CurrentQuarterlyKicker = 3
If FourthQuarterButton Then CurrentQuarterlyKicker = 4
Unload Sales_Compensation_UserForm
End Sub

'Here is the Select case structure I used to turn off
formulas based on the choices made on the userform:

Range("A1").Select
Select Case CurrentQuarterlyKicker
Case 3: Range("J31, K31, L31, M31") = 0
Range("A1").Select
Case 2: Range("J30, J31, K30, K31, L30, L31, M30, M31") = 0
Range("A1").Select
Case 1: Range("J29, J30, J31, K29, K30, K31, L29, L30,
L31, M29, M30, M31") = 0
Range("A1").Select
Case None: Range("J28, J29, J30, J31, K28, K29, K30, K31,
L28, L29, L30, L31, M28, M29, M30, M31") = 0
Range("A1").Select
End Select

I thought if the choice of 4 was chosen then nothing would
happen. If choice 3 was chosen then the cells calculating
a 4Q amount would be turned to zero, etc. However, every
choice on the userform results in all formulas turned to
zero which should only happen for the choice of None.

Thank you.

 
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
Calculate working days but change working week SamB Excel Discussion (Misc queries) 1 September 1st 08 09:17 PM
Making weekend days working days - the system cuts the working tim Fluffy Excel Discussion (Misc queries) 1 May 30th 08 10:02 PM
EnableancelKey=xlErrorHandler not working in UserForm Nathan Gutman Excel Programming 2 January 20th 04 02:32 PM
Adding sales from a non working day to the previous working day Alex Excel Programming 1 September 19th 03 08:48 AM
userform jim apostolidis Excel Programming 1 August 11th 03 10:37 AM


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