M
Mik
I have a range of cells b3:b5 which show UserNames of people who will
use the spreadsheet.
The adjacent cells c3:c5 allow a manual input from the user.
The user must enter the info in their specific adjacent cell only.
So, when any of these cells c3:c5 are selected, i wish to run a macro
(preferably before user input) which will check to see that the
current user is entering info within the correct cell.
I determine the user with the Environ("username") function.
For info, i am using Excel 2007.
My code at present is:-
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$c$3" Then
If Range("b3").Value = Environ("username") Then 'allow entry
Exit Sub
Else
MsgBox ("Wrong User Input!")
End If
Else
'code to repeat for $c$4, and $c$5 etc...
End If
End Sub
use the spreadsheet.
The adjacent cells c3:c5 allow a manual input from the user.
The user must enter the info in their specific adjacent cell only.
So, when any of these cells c3:c5 are selected, i wish to run a macro
(preferably before user input) which will check to see that the
current user is entering info within the correct cell.
I determine the user with the Environ("username") function.
For info, i am using Excel 2007.
My code at present is:-
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$c$3" Then
If Range("b3").Value = Environ("username") Then 'allow entry
Exit Sub
Else
MsgBox ("Wrong User Input!")
End If
Else
'code to repeat for $c$4, and $c$5 etc...
End If
End Sub