Click cell sends its value to another cell
Solved
Fat17
Posted messages
90
Status
Member
-
Anonymous user -
Anonymous user -
Hello,
I have 4 grading options based on the result:
A in L7
B in L8
C in L9
D in L10
I would like to be able to click on the corresponding grade (A, B, C, or D) based on the result obtained and see this result automatically reflected in cell P3.
Is that possible?
Thank you for your assistance
Best regards
Fat
Configuration: Windows / Chrome 87.0.4280.141
I have 4 grading options based on the result:
A in L7
B in L8
C in L9
D in L10
I would like to be able to click on the corresponding grade (A, B, C, or D) based on the result obtained and see this result automatically reflected in cell P3.
Is that possible?
Thank you for your assistance
Best regards
Fat
Configuration: Windows / Chrome 87.0.4280.141
3 answers
-
Hello,
It's possible with a small macro to place in the relevant sheet.
Right-click on the tab > View code > Copy-paste the macro below
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Application.Intersect(Target, Range("L7:L10")) Is Nothing Then Range("P3").Value = Target.Value End If End Sub -
Thank you RoMa
It works very well as long as the sheet is not protected.
Otherwise, it gets stuck.
Is there a possibility for adaptation?
Regards
Fat -
2 solutions :
- The sheet being unprotected, we only unlock cell P3: Right click > Format Cells > Protection > uncheck "Locked" > Protect the sheet. The macro will work as is.
- Use the modified macro as below. It removes/reapplies protection on the fly:
the value of the constant motDePasse must of course contain your current password.
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Const motDePasse = "12345" If Not Application.Intersect(Target, Range("L7:L10")) Is Nothing Then ActiveSheet.Unprotect (motDePasse) Range("P3").Value = Target.Value ActiveSheet.Protect (motDePasse) End If End Sub