PDA

View Full Version : Question with Forms in VBA



Minots59
10-20-2011, 10:11 AM
Hello Everyone,

I am attempting to writing a program that will open a prompt with multiple option buttons. Each button will change the background color of specified cells. My problem is configuring the specified cells. I want the configured columns to always be A through I but I want the rows to be user defined, basically by having them pre-selected. Is there a way to write code for that? Thanks guys.

mikerickson
10-20-2011, 10:19 AM
I'm not sure what your vision is for the user's actions.

It sounds like:
User selects a discontinuous range
User presses a button which shows a user form
The user form has option buttons, matching the areas of the selected range.
The user selects one of the buttons and presses ChangeBackground button.
Userform goes away and the selected cells change color.

(In which case it sounds easier to omit the user form all together.)

OR

Do you want another button on the form MatchButtonToRange that allows the user to define which button means which range and will be preserved for the next invocation of the UF.

OR is there a different sequence of actions that you are envisioning?

Minots59
10-20-2011, 10:24 AM
The first option definitely sounds pretty nice. My original intent was to have a check box on the main screen. When this box is checked, it enables a double click feature to the first cell on a row. Where when the first cell is double clicked, the user form pops up with option to pick to change background color of that specified row up to column I. When the box is not checked and the cell is double clicked, it allows normal editing of the text. I hope that makes sense. But honestly the first thing you said sounds much more simple and user friendly.

mikerickson
10-20-2011, 11:48 AM
What is the purpose of the userform?
To indicate color or to choose between options of ranges?

Also, since Excel's handling of color has changed, what version of Excel is this for.