Show cell content when it is selected

Si14

New Member
Joined
May 29, 2012
Messages
18
Hello,

I have a worksheet to mark the student exams. The final mark is a formula and I want to hide the number value. However, when I click on it or select it, I want it to show.
Since I want to show the students this file on my computer, however, I don't want them to see other students marks.
How to do this?
I do not want to make this as comments, since the number is the results of a formula.

Thanks for your help.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
if results are in (for example) column K you can use this ( in the sheet you use):

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("K:K").Font.Color = xlNone
        If Not Intersect(Range("K:K"), Target) Is Nothing Then
            Target.Font.Color = vbBlack
        End If
End Sub
 
Last edited:
Upvote 0
Thank you for your reply. Could you please let me know how to use this code (where to type it). I am not familiar with macro codes.

if results are in (for example) column K you can use this ( in the sheet you use):

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("K:K").Font.Color = xlNone
        If Not Intersect(Range("K:K"), Target) Is Nothing Then
            Target.Font.Color = vbBlack
        End If
End Sub
 
Upvote 0
Copy the code, right-click on the sheet tab, select View Code, paste it there (Alt+F11 toggles VBA Window)
 
Last edited:
Upvote 0
Open the Vb-editor with ALT-F11 and select the sheet in which you want the magic to happen on the left of the screen. Then paste the code into the white area on the rigtht.
 
Last edited:
Upvote 0
Hello,

I have a worksheet to mark the student exams. The final mark is a formula and I want to hide the number value. However, when I click on it or select it, I want it to show.
Since I want to show the students this file on my computer, however, I don't want them to see other students marks.
How to do this?
I do not want to make this as comments, since the number is the results of a formula.

Thanks for your help.

Try something like this
Say your data are in Sheet1 like this

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[TD="bgcolor: #DCE6F1"]
C
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD]
StudentCode​
[/TD]
[TD]
Name​
[/TD]
[TD]
Mark​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD]
1​
[/TD]
[TD]
Anthony​
[/TD]
[TD]
A​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD]
2​
[/TD]
[TD]
Charles​
[/TD]
[TD]
B​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD]
3​
[/TD]
[TD]
Mary​
[/TD]
[TD]
A​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
5
[/TD]
[TD]
4​
[/TD]
[TD]
Richard​
[/TD]
[TD]
C​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
6
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Then in another sheet

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[TD="bgcolor: #DCE6F1"]
C
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD]
Enter Student's Code​
[/TD]
[TD]
Name​
[/TD]
[TD]
Mark​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD]
2​
[/TD]
[TD]
Charles​
[/TD]
[TD]
B​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Formula in B2
=IF(A2="","",VLOOKUP(A2,Sheet1!A:C,2,0))

Formula in C2
=IF(A2="","",VLOOKUP(A2,Sheet1!A:C,3,0))

So, when you enter the student's code in A2 you will see the name and the mark.

M.
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,985
Members
452,540
Latest member
haasro02

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