Problem with a RollOver

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:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal target As Range
    If Not Intersect(target, [D10]) Is Nothing Then MyMacro
End Sub
"MyMacro" is the macro that should be triggered when you click on cell D10.

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.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Excuse me, but, after having reread myself, and unable to modify my message, it should read:
I choose another cell (for example D1) and name it: "CELL_REFERENCE"
and not :
I choose another cell (for example D2) and name it: "CELL_REFERENCE"
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,607
Members
449,090
Latest member
vivek chauhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top