lock cell

K

kalpesh

Hello
f worksheet 1 in " A1 " cell enter any value than cursor move othe
cell otherwise massage box shown " enter any value

give me vba macro for this proble

how it possible
 
A

Auric__

kalpesh said:
f worksheet 1 in " A1 " cell enter any value than cursor move other
cell otherwise massage box shown " enter any value "

Can you clarify this? It looks like you're asking for verification that A1
hasn't been left blank, is that right? If so, put this in the sheet's object
in the VBA editor:

Private currentCell As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not (currentCell Is Nothing) Then
If currentCell.Address = "$A$1" Then
If Len(currentCell.Value) < 1 Then
MsgBox "A1 cannot be blank."
Set currentCell = Nothing
Cells(1, 1).Select
Else
Set currentCell = Target
End If
Else
Set currentCell = Target
End If
Else
Set currentCell = Target
End If
End Sub

I leave it to you to figure out how to get currentCell set to the proper
value the first time the sheet is displayed.
give me vba macro for this problem

how it possible

Let's see if he replies this time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top