ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   lock cell (https://www.excelbanter.com/excel-programming/446544-lock-cell.html)

kalpesh

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

give me vba macro for this problem

how it possible

Auric__

lock cell
 
kalpesh wrote:

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.

--
Come explore the future with me!


All times are GMT +1. The time now is 02:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com