MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 3rd, 2002, 03:09 PM   #1
tanyagi
New Member
 
Join Date: May 2002
Posts: 5
Default

Hi,

Can someone HELP!!! We're trying to get a spin button to increase a cell by 0.01 however it will only allow an interger eg 1, 2 etc. How can we fix this so we can either have a figure override the spin button (or use it) and get it to create .00 values. Fixed decimals seem to work but then mess every other value up..... HELP

[ This Message was edited by: tanyagi on 2002-05-05 09:10 ]
tanyagi is offline   Reply With Quote
Old May 3rd, 2002, 03:17 PM   #2
lenze
MrExcel MVP
 
lenze's Avatar
 
Join Date: Feb 2002
Location: Helena, MT
Posts: 13,690
Default

You can use code for this

Sub Spinner1_Change()
Range("YourCell").Value = ActiveSheet.Spinners("Spinner 1").Value * 0.01
End Sub
lenze is offline   Reply With Quote
Old May 3rd, 2002, 03:32 PM   #3
IML
MrExcel MVP
 
Join Date: Feb 2002
Location: Denver, CO
Posts: 1,744
Default

I'm sure Lenze's answer is the superior one. But if you (like me) wouldn't know what to do with that code, why not tie the spinner to a hidden cell, say a1, and then use =a1/100 in your visable cell? Just a band-aid, but it may work for you.
IML is offline   Reply With Quote
Old May 3rd, 2002, 03:43 PM   #4
lenze
MrExcel MVP
 
lenze's Avatar
 
Join Date: Feb 2002
Location: Helena, MT
Posts: 13,690
Default

Actually, it depends on what type of Spinner you are using. If from the forms toolbar, place the code in a regular module and assign the macro to the spinner. If from the Controls Toolbar, right click and choose View Code to insert it in the SpinButton Module
lenze is offline   Reply With Quote
Old May 4th, 2002, 08:31 AM   #5
tanyagi
New Member
 
Join Date: May 2002
Posts: 5
Default

HITTING PROBLEMS

Basically I need to make sure people either use the spinner which looks up a formula as suggested by IML. But can't think how to stop someone being able to input there own value.


I've tried lenze formula (Spinner from control toolbar - not forms)

Trying to spin B50 using

Private Sub Alpha2_Change()
Range("B50").Value = ActiveSheet.Spinners("Alpha2").Value * 0.01
End Sub

But this creates the Run time error 1004, that says unable to get the spinner property of the worksheet class. I might have made a stupid error, any ideas please??


[ This Message was edited by: Tanyagi on 2002-05-04 07:33 ]

[ This Message was edited by: tanyagi on 2002-05-04 07:47 ]
tanyagi is offline   Reply With Quote
Old May 4th, 2002, 09:50 AM   #6
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

This works fine for me...



Private Sub Alpha2_Change()
Range("B50").Value = Alpha2.Value * 0.01
End Sub



Tom
Tom Schreiner is offline   Reply With Quote
Old May 5th, 2002, 05:38 AM   #7
tanyagi
New Member
 
Join Date: May 2002
Posts: 5
Default

Sooooooooooo Close,

Tom your formula works great until I try and use the spinner to create a value above 50. so 51 etc makes it go back to 1. Also it won't let me start on 0, has to be 0.01 - not such a problem, can put a comment in. The max value is set on 100 and min in 1 - won't work if min 0.

Any ideas?? it seems so close.


Not sure if any of these could be messing it up
Locked True. Autoload False. Enabled True.
Placement 2. Delay 100
tanyagi is offline   Reply With Quote
Old May 5th, 2002, 06:22 AM   #8
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

I'm kinda guessing at your range of values?
0 to 100
Counting in One-Hundedths .01

Use the following code:



Private Sub Alpha2_SpinDown()
If Range("B50").Value = 0 Then Exit Sub
Range("B50").Value = Range("B50").Value - 0.01
End Sub

Private Sub Alpha2_SpinUp()
If Range("B50").Value = 100 Then Exit Sub
Range("B50").Value = Range("B50").Value + 0.01
End Sub




OR



Option Explicit
Dim Num As Range

Private Sub Alpha2_Change()
Set Num = Range("B50")
End Sub


Private Sub Alpha2_SpinDown()
If Num = 0 Then Exit Sub
Num = Num - 0.01
End Sub

Private Sub Alpha2_SpinUp()
If Num = 100 Then Exit Sub
Num = Num + 0.01
End Sub



Tom


[ This Message was edited by: TsTom on 2002-05-05 05:27 ]
Tom Schreiner is offline   Reply With Quote
Old May 5th, 2002, 08:32 AM   #9
tanyagi
New Member
 
Join Date: May 2002
Posts: 5
Default

Getting closer still, but no jackpot and not sure about you but my head is starting to hurt, even though your doing the hard code part.

Couldn't make the second code work but the first now goes down to 0, but will not let the spinner create values above 50, without reseting the count to 0.01. It is VERY STRANGE.

I even moved it to cell 100 incase the fact it was in B 50 was causing the prob, no joy.

Code as stand at the mo is...


Private Sub Alpha3_Change()
Range("B100").Value = Alpha3.Value * 0.01
End Sub

Private Sub Alpha3_SpinDown()
If Range("B100").Value = 0 Then Exit Sub
Range("B100").Value = Range("B100").Value - 0.01
End Sub

Private Sub Alpha3_SpinUp()
If Range("B100").Value = 100 Then Exit Sub
Range("B100").Value = Range("B100").Value + 0.01
End Sub



Tanya.



[ This Message was edited by: tanyagi on 2002-05-05 07:34 ]
tanyagi is offline   Reply With Quote
Old May 5th, 2002, 12:06 PM   #10
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Delete this and double-chech my previous reply...
We are not going to use the value of your spin button at all....

Private Sub Alpha3_Change()
Range("B100").Value = Alpha3.Value * 0.01
End Sub

Delete it and your code will work.

Tom
Tom Schreiner is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 12:58 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes