View previous topic :: View next topic |
Author |
Message |
Grabowski Blue Pill
Joined: Oct 01, 2006 Posts: 2
|
Posted: Sat Nov 25, 2006 1:03 pm Post subject: Calc Makro Programming - How to compare cell values |
|
I'm trying to write a vocabular training tool with NeoOffice Calc. And there I want to use a makro to compare the content of two cells and depending on the result I want to set the color of the cell.
My very simple problem is now: How can I compare two cells using a makro?
The following program code doesn't work:
If B1 = B2 Then ...
or
If B1.Value = B2.Value Then ...
or
If Range(B1).Value = Range(B2).Value Then...
or ...
I don't know how to read the value of a cell. Unfortunately "Help" didn't help me. |
|
Back to top |
|
|
Samwise Captain Naiobi
Joined: Apr 25, 2006 Posts: 2315 Location: Montpellier, France
|
Posted: Sat Nov 25, 2006 1:20 pm Post subject: |
|
Unfortunately, there are few people here with in-depth knowledge of StarBasic and OpenOffice.org macros. You should get better answers there :
http://www.oooforum.org/ |
|
Back to top |
|
|
Grabowski Blue Pill
Joined: Oct 01, 2006 Posts: 2
|
Posted: Sat Nov 25, 2006 1:58 pm Post subject: |
|
Thank you for your hint.
I didn't know that reading the value of a cell is a job for experts.
But fortunately I'm one of those experts now
|
|
Back to top |
|
|
Samwise Captain Naiobi
Joined: Apr 25, 2006 Posts: 2315 Location: Montpellier, France
|
Posted: Sat Nov 25, 2006 2:32 pm Post subject: |
|
Yeah, well
It probably isn't such a big deal, but you have to learn the syntax somewhere, and if you don't know, it can take a long time to figure out; it's much easier to ask people who already know ... |
|
Back to top |
|
|
jgd Agent Smith
Joined: Feb 27, 2005 Posts: 1531 Location: France
|
Posted: Sun Nov 26, 2006 2:35 am Post subject: |
|
Grabowski
You may check Andrew Pitonyak's document, which you can download here :
http://www.pitonyak.org/oo.php
Click PDF English Macro Document (Updated November 9, 2006)
It contains a chapter about Calc macros which can help you.
Jacqueline |
|
Back to top |
|
|
Jim Councilperson
Joined: Jun 21, 2003 Posts: 173 Location: Selmer, Tennessee
|
Posted: Sun Nov 26, 2006 11:16 am Post subject: |
|
Unless you want to do something other than change the cell's background color, then just use Format->Conditional formatting...
Let's say, for example, you want to indicate wrong answers by changing the cell background to red. Define a cell style with that background color, and name it "wrong answer". Then, click in the answer cell to select it, and choose Format->Conditional formatting... Set your parameters, choose the "wrong answer" style, and you're done. No macro needed. _________________ Jim Plante
MacOS X 10.6.34, MacBook 2GHz C2Duo, 2gb, Neo 3.1.1 p 1 |
|
Back to top |
|
|
|