Conditional editing

  • Thread starter Thread starter sudhanshu
  • Start date Start date
S

sudhanshu

I have worked on Conditional formatting but on one of the project I a
presently working requires COnditional editing.

I there any way to do this.

For example, if a criteria in a cell is true then two or three column
as well as rows should get inserted (deleted in case the condition i
False) at particular place for taking addtional data.

Also is the criteria is met only then it should be possible to edi
otherwise not.

Please help

Thanking you in advance
Sudhansh
 
Hi Sudhanshu

this can't be done with formulas. One way would be to process the
worksheet_change event, test for your condition and - if met -
insert/delete the row/columns. To give you an idea, the following code
inserts one row if cell A1 = 1
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
If .Value = 1 Then
.Offset(1, 0).EntireRow.Insert
End If
End With

CleanUp:
Application.EnableEvents = True
End Sub

HTH
Frank
 
Everything you say you want to do is possible with VBA, but you have to
provide more details about what you have and what you want to happen.
You say "if a criteria in a cell is true". What does that mean? And
exactly what do you want to happen and where do you want it to happen if it
is true and the same question for when it is not true. HTH Otto
 
Back
Top