jetjaguar15
New Member
- Joined
- May 14, 2015
- Messages
- 2
I have the following Code setup.
' Don't allow changes in the column names or outside of the table borders
If Target.Row < 2 Or Sh.Cells(1, Target.Row).Text = "" Or Sh.Cells(1, Target.Column) = "" Or (Target.Row > nRecordCount + 1) Then
Target.Value = oldValue
oldValue = Application.ActiveCell.Value
MsgBox "You can only edit items inside the table"
Exit Sub
End If
' Is this change is in a primary key column - if so, we can't edit it
If (IsInPrimaryKey(Sh.Cells(1, Target.Column).Text)) Then
Target.Value = oldValue
oldValue = Application.ActiveCell.Value
MsgBox "This column is a part of the primary key, so it cannot be changed"
Exit Sub
End If
' Is this change on a Original Forecast Column - if so, we can't edit it
If Then
Target.Value = oldValue
oldValue = Application.ActiveCell.Value
MsgBox "Only The New Forecast can be Changed"
Exit Sub
End If
I need the last If statement to check the row and see if column K has the value "FCST". If it does, the rest of the if needs to execute to reset the cell value.
What do I need here? Something with Target.Row?
' Don't allow changes in the column names or outside of the table borders
If Target.Row < 2 Or Sh.Cells(1, Target.Row).Text = "" Or Sh.Cells(1, Target.Column) = "" Or (Target.Row > nRecordCount + 1) Then
Target.Value = oldValue
oldValue = Application.ActiveCell.Value
MsgBox "You can only edit items inside the table"
Exit Sub
End If
' Is this change is in a primary key column - if so, we can't edit it
If (IsInPrimaryKey(Sh.Cells(1, Target.Column).Text)) Then
Target.Value = oldValue
oldValue = Application.ActiveCell.Value
MsgBox "This column is a part of the primary key, so it cannot be changed"
Exit Sub
End If
' Is this change on a Original Forecast Column - if so, we can't edit it
If Then
Target.Value = oldValue
oldValue = Application.ActiveCell.Value
MsgBox "Only The New Forecast can be Changed"
Exit Sub
End If
I need the last If statement to check the row and see if column K has the value "FCST". If it does, the rest of the if needs to execute to reset the cell value.
What do I need here? Something with Target.Row?