So I have to do a project for work. What I am trying to do is get a cell in excel to display the text in whichever cell I am clicking on, or whichever cell my mouse is over. I would prefer the former but if you only know the latter I would be good with that too.
Thanks
Update:I am not trying to hide the cell... I want to click on the context and have another cell display them. The contents in the cells I will be clicking on will be too much to display all of it in just the cell space, so I made another, larger cell, that I want to display the contents of the cell I am clicking on in the larger cell.
Copyright © 2024 Q2A.ES - All rights reserved.
Answers & Comments
Verified answer
Here is one way to do as you wish using a SelectionChange event handler. This example assumes that the cell to display the contents of the cell clicked on is A1.
If your cell is not "A1", change the "A1" reference to your specific cell, i.e. "B4", "M12", etc.
Then, copy the event handler below, modified as needed, to the clipboard (highlight the entire code, right click inside the highlighted area, and 'Copy'):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("A1").Value = Target.Value
End Sub
Select the worksheet containing the 'larger cell' and right click the sheet tab at the bottom.
Select 'View Code'.
Paste the event handler into the white editing area to the right (right click inside the area and 'Paste').
Close the VBE (red button w/white 'x' - top right).
Select any cell and the designated cell will display the contents of the active cell.
Hi. The other way is by inserting a comment box, which will appear when you move the mouse over that particular cell.
Select the cell, right-click>insert comment. You can drag the corners or sides of the comment box to make it as big as you wish. All that will show in the cell is a small red triangle, indicating that cell contains a comment.
Hope that helps.