Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
BEFORE SheetSelectionChange
Thanks for taking the time to read my question.
I'm using Excel 2003 and I want to capture changes to a cell's value. How do I know with VBA that a cells value has changed / updated? I tried SheetSelectionChange, but it only gives me the value of the new cell. Basically what I'm trying to do is if a cells value has gone from "" to anything, lock the cell so it can't be edited. Thanks, Brad |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
BEFORE SheetSelectionChange
Cells are, by default, locked IF the sheet is protected. use a
worksheet_change event if UNlocked Private Sub Worksheet_Change(ByVal Target As Range) If Target < "" Then Target.Locked = True End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Brad" wrote in message ... Thanks for taking the time to read my question. I'm using Excel 2003 and I want to capture changes to a cell's value. How do I know with VBA that a cells value has changed / updated? I tried SheetSelectionChange, but it only gives me the value of the new cell. Basically what I'm trying to do is if a cells value has gone from "" to anything, lock the cell so it can't be edited. Thanks, Brad |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
BEFORE SheetSelectionChange
Here is what I have just just figured out.
Worksheet is protected. Dim EnterCellVal As Variant Dim EnterCellRow As Integer Dim EnterCellCol As Integer Private Sub Workbook_SheetCalculate(ByVal Sh As Object) If Cells(EnterCellRow, EnterCellCol).Value < EnterCellVal Then ActiveSheet.Unprotect Cells(EnterCellRow, EnterCellCol).Locked = True ActiveSheet.Protect End If End Sub Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) EnterCellVal = ActiveCell.Value EnterCellRow = ActiveCell.Row EnterCellCol = ActiveCell.Column End Sub Brad "Don Guillett" wrote: Cells are, by default, locked IF the sheet is protected. use a worksheet_change event if UNlocked Private Sub Worksheet_Change(ByVal Target As Range) If Target < "" Then Target.Locked = True End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Brad" wrote in message ... Thanks for taking the time to read my question. I'm using Excel 2003 and I want to capture changes to a cell's value. How do I know with VBA that a cells value has changed / updated? I tried SheetSelectionChange, but it only gives me the value of the new cell. Basically what I'm trying to do is if a cells value has gone from "" to anything, lock the cell so it can't be edited. Thanks, Brad |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SheetSelectionChange when modal form is shown | Excel Programming | |||
SheetSelectionChange | Excel Programming | |||
SheetSelectionChange Event find out previosly selected cell | Excel Programming | |||
SheetSelectionChange | Excel Programming | |||
SheetSelectionChange Target size Limitation? | Excel Programming |