| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| VB arrays (excel based) | |
|---|---|
| Tweet Topic Started: Jan 23 2005, 04:36 PM (1,518 Views) | |
| kingy | Jan 23 2005, 04:36 PM Post #1 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
ok this takes the cell E2 and then changes the colour of "Rectangle 2" dependant on what E2 displays. it is really long and complicated and was wondering if anybody could simplify it for me (perhaps with an array, i dunno) thanks, i am new to VB so any help is appreciated |
![]() |
|
| James | Jan 23 2005, 07:01 PM Post #2 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
What about something like:
I wrote it quickly, don't have VB installed so can't test it, but in theory it should do the same thing. |
![]() |
|
| Seth | Jan 23 2005, 07:02 PM Post #3 |
|
I has a pony
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Actually, VB is incompatible with the British spelling of color :ph34r: |
![]() |
|
| James | Jan 23 2005, 07:03 PM Post #4 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yes....but i'm declaring a variable called iColours, so it should be ok All the rest of the "color"'s are correctly specified.
|
![]() |
|
| Seth | Jan 23 2005, 07:24 PM Post #5 |
|
I has a pony
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
No, any appearance of British words will automatically crash VB :ph34r: really, promise :ph34r:
|
![]() |
|
| kingy | Jan 24 2005, 08:08 AM Post #6 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
thanks, i have modified it a little, but now it isn't changing the colours correctly, eg, i have changed the hex codes but they won't appear the right colour. any help appreciated! kingy (sorry for being a pain) |
![]() |
|
| Stefan | Jan 24 2005, 09:34 AM Post #7 |
![]()
Mew?
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Maybe changing the order in the hex colours might help. In CSS, for instance, it's like this: #RRGGBB But I know that when you set a color for GUI elements (text input box, buttons, etc.) in Visual Basic, the hex code is like this: &HBBGGRR |
![]() |
|
| SkItZo | Jan 24 2005, 10:14 AM Post #8 |
|
Support Volunteer
![]() ![]() ![]() ![]() ![]()
|
color hexes in VB are of this type: &H0000FF00& Thats the color lime if you're wondering. Of, if you're using C++ use this... 0x00FF00 same color, but different hex code. |
![]() |
|
| James | Jan 24 2005, 07:58 PM Post #9 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Yup, the reason i added the IF statement was because if you wrote in 7 by accident there wouldn't be an iColours for it, so the IF statement checked whether the number was below or equal to the maximum array count (UBOUND) before doing anything. but your choice. I thought the RGB might cause you problems, have you tried removing the .RGB and seeing if it makes any difference? I really need to install my VB copy... |
![]() |
|
| kingy | Jan 25 2005, 01:56 PM Post #10 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
well it doesn't have to be RGB, colorindex (or indexcolor , whatever they call it) would be alright as well, but i don't know VB very well so i can't edit right |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Technology Chat · Next Topic » |
| Track Topic · E-mail Topic |
7:05 AM Jul 11
|



![]](../../../../0/1/0/p601690/pipright.png)



All the rest of the "color"'s are correctly specified.

7:05 AM Jul 11