Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting Data for a Graph
Message
 
To
31/03/2003 14:49:52
General information
Forum:
Microsoft Office
Category:
Excel
Miscellaneous
Thread ID:
00768653
Message ID:
00772970
Views:
17
I've done a lot of VBA in Excel, but very little with forms. And my two books weren't much help either. However, I learn a lot from looking at other programs. This excerpt is from a sample program that came with one of the books.
Sub cbProtectSheet_Click()
'   Toggles sheet protection
    If Sheets("TimeSheet").CheckBoxes("cbProtectSheet").Value = xlOn Then
        ActiveSheet.Protect DrawingObjects:=True, Contents:=True
    Else
        ActiveSheet.Unprotect
    End If
End Sub
>I know this is a little off the subject, but how do I go about addressing a CheckBox? Here's what I tried codewise (which turned out to be erroneous):
>
>If Worksheets("XFMR Relay Test Sheet").CheckBoxes(1).Checked = False Then
>
>
>The checkbox is on this particular worksheet and is named Checkbox1. I'm using my knowledge of programming Foxpro and kinda guessing my way through. I originally tried addressing it as Checkbox1.Checked, but that didn't work either. Could someone throw me a bone, please?
>
>
>
>
>
>
>>I don't know of any way to do that. I doubt if you can unless you store a previous compare to value somewhere on the sheet. What I was picturing was logic that would do whatever using the value that is in the cell you're interested in reguardless of if it changed or not when a button was pressed.
>>
>>If you really did need to compare the value first, you could do this.
>>Compare your data (say column B) and look at the rows you want. Compare them to say column Z or anything else that is way over to the right and not seen. If they don't match do the logic you want then copy column B to column Z. The first time you run this, column Z is blank. So, even the first time it is ran it would work. If it possible that valid data can be blank, you could initialize those cells in column Z to contain "ZZZZZ" or something that you know would not be entered.
>>
>>HTH
>>
>>
>>>I have an idea, but need a little help ... How do I programmatically run a macro on a value change in a cell?
>>>
>>>Thanks for the response.
>>>
>>>JD
>>>
>>>>The only way I could think to do this is to select one of your 12 choices, then click a button that runs some VBA code. Or have just the VBA code in a button and when it is clicked, it starts with a message box that has the 12 selections. I don't think the VBA code to do something like that would be hard to write at all. If you start it and have problems, let me know.
>>>>
>>>>
>>>>>I'm hoping someone will have an idea for me on this one. I have a drop down box w/ 12 choices. I want each of these choices to select one of 12 columns of data, and move that data's contents into a blank column.
>>>>>
>>>>>I can't use IF() because you can only nest 7 of these and I have 12.
>>>>>
>>>>>Here's the idea, though, using IF():
>>>>>
>>>>>IF(010,select column 1 and put it into blank column N,IF(1020,select column 2 and put data into blank column N,IF(........
>>>>>
>>>>>Does anyone have an idea for a better way to do this?
>>>>>
>>>>>Thanks
>>>>>
>>>>>JD
___________________________
Kenneth Wonderley
http://www.wonderley.com


...the fruit of the Spirit is love, joy, peace, patience, kindness, goodness, faithfulness, gentleness and self-control.
Galatians 5:22 & 23
Previous
Reply
Map
View

Click here to load this message in the networking platform