Magic_Doctor
Board Regular
- Joined
- Mar 18, 2009
- Messages
- 56
Hello,
What I want to get:
I have a red cell with yellow "D" written on it.
When I hover over this cell, the cell turns black and "D" white. And when I leave the cell area, it turns red with yellow "D".
So far I've been there.
But when I am on the cell (black cell / white “D”) and I click on it, then an event macro should be triggered. There it does not work, impossible to trigger the macro.
Since we cannot send files, I explain how I did it.
I choose a cell (for example: D3), I put a red background and I write "D" in yellow.
I frame this cell with 4 cells (C3 / D2 / E3 / D4) which keep the color of the leaf.
In each of these cells, I write "000000000", so that each of these cells is filled with "0".
I choose another cell (for example D2) and name it: "CELL_REFERENCE"
I point out that the cell with its framing and the cell "CELLULE_REFERENCE" will subsequently be hidden.
I copy the red cell with its frame and I paste everything else on the sheet. Suppose the pasted red cell is in D10.
End of the first stage.
In the sheet module, I write:
"MyMacro" is the macro that should be triggered when you click on cell D10.
In a standard module, I write:
On the copied red cell, I write:
= IFERROR (HYPERLINK(VALEUR_cellule(D2));D2)
On the cells (with "0") that surround the red cell (C10 / D9 / E10 / D11), I write:
= IFERROR (HYPERLINK(VALEUR_cellule(C3));C3)
= IFERROR (HYPERLINK(VALEUR_cellule(D2));D2)
= IFERROR (HYPERLINK(VALEUR_cellule(E3));E3)
= IFERROR (HYPERLINK(VALEUR_cellule(D4));D4)
I come back to the pasted cell D10 and I apply a conditional format to it:
In the formula box, I write:
=CELLULE_REFERENCE="D"
And for the format, I choose:
Interior. Color = black
Font.Color = white
We hide the cells of the first stage and that’s all!
When you fly over cell D10 it changes its appearance, but the macro does not fire when you click on it. How to solve this problem ?
Many thanks for any help.
What I want to get:
I have a red cell with yellow "D" written on it.
When I hover over this cell, the cell turns black and "D" white. And when I leave the cell area, it turns red with yellow "D".
So far I've been there.
But when I am on the cell (black cell / white “D”) and I click on it, then an event macro should be triggered. There it does not work, impossible to trigger the macro.
Since we cannot send files, I explain how I did it.
I choose a cell (for example: D3), I put a red background and I write "D" in yellow.
I frame this cell with 4 cells (C3 / D2 / E3 / D4) which keep the color of the leaf.
In each of these cells, I write "000000000", so that each of these cells is filled with "0".
I choose another cell (for example D2) and name it: "CELL_REFERENCE"
I point out that the cell with its framing and the cell "CELLULE_REFERENCE" will subsequently be hidden.
I copy the red cell with its frame and I paste everything else on the sheet. Suppose the pasted red cell is in D10.
End of the first stage.
In the sheet module, I write:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal target As Range
If Not Intersect(target, [D10]) Is Nothing Then MyMacro
End Sub
In a standard module, I write:
Code:
Public Function VALEUR_cellule(cellule As Range)
[CELLULE_REFERENCE] = cellule.Value
End Function
On the copied red cell, I write:
= IFERROR (HYPERLINK(VALEUR_cellule(D2));D2)
On the cells (with "0") that surround the red cell (C10 / D9 / E10 / D11), I write:
= IFERROR (HYPERLINK(VALEUR_cellule(C3));C3)
= IFERROR (HYPERLINK(VALEUR_cellule(D2));D2)
= IFERROR (HYPERLINK(VALEUR_cellule(E3));E3)
= IFERROR (HYPERLINK(VALEUR_cellule(D4));D4)
I come back to the pasted cell D10 and I apply a conditional format to it:
In the formula box, I write:
=CELLULE_REFERENCE="D"
And for the format, I choose:
Interior. Color = black
Font.Color = white
We hide the cells of the first stage and that’s all!
When you fly over cell D10 it changes its appearance, but the macro does not fire when you click on it. How to solve this problem ?
Many thanks for any help.