Cell Value

sohaibj

Board Regular
Joined
Jan 28, 2004
Messages
158
I want a user to enter its employee # in cell (let say) A1.
I don't want him to skip this cell, he must fill this cell.
How can I force him to fill this cell and dont let him goto next cell without filling this cell?
I am using Excel 2007
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Gary McMaster

Well-known Member
Joined
Feb 8, 2009
Messages
1,977
I don't think there is any way to do it without using code. Even if you do use code, your user can get around your scheme by disabling macros on open.

If you turn on worksheet protection with all cells locked except for the one you decide must be filled in then something like the following code may suit your needs. The sample is using an empty password ("") but a real password will probably be required. If the user disables macros they will not be able to unlock the sheet without knowing the password which is embedded in the code. If macros are enabled then they must enter a valid employee number in cell "A1" before the code will unlock the sheet.

Hope it helps.

Gary


Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False

If Target.Address = "$A$1" Then

    Select Case Target.Value
        Case 1234
            MsgBox "Welcome John Doe"
            ActiveSheet.Unprotect password:=""
        Case 5678
            MsgBox "Welcome Jane Smith"
            ActiveSheet.Unprotect password:=""
        Case Else
            MsgBox "Invalid employee number, please try again"
    End Select

End If

Application.EnableEvents = True

End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,132,786
Messages
5,655,298
Members
418,187
Latest member
polks111

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
Top