dampfleece
New Member
- Joined
- Sep 12, 2014
- Messages
- 14
Hello all,
Can anyone advise how to reference a cell in VB so that the macro continues to work even if rows / columns are inserted in the worksheet at a later date.
I am putting together a form for other users to complete and using code to ensure that certain rules are followed for defaults and fields for completion. However, just using the cell ref (C4) or ($C$4) seems to fail if I then insert a row above row 4.
For ref. an example from the code is:
If Not Application.Intersect(Target, Range("C4")) Is Nothing Then
Application.EnableEvents = False
If Range("C4") = "Capped Usage" Then
Rows("5:5").EntireRow.Hidden = False
Else
Rows("5:5").EntireRow.Hidden = True
Range("C17") = ""
End If
Application.EnableEvents = True
End If
Any help would be much appreciated - note that I am (very) new to VB and am mostly using trial and error from stuff copied from the net!
Can anyone advise how to reference a cell in VB so that the macro continues to work even if rows / columns are inserted in the worksheet at a later date.
I am putting together a form for other users to complete and using code to ensure that certain rules are followed for defaults and fields for completion. However, just using the cell ref (C4) or ($C$4) seems to fail if I then insert a row above row 4.
For ref. an example from the code is:
If Not Application.Intersect(Target, Range("C4")) Is Nothing Then
Application.EnableEvents = False
If Range("C4") = "Capped Usage" Then
Rows("5:5").EntireRow.Hidden = False
Else
Rows("5:5").EntireRow.Hidden = True
Range("C17") = ""
End If
Application.EnableEvents = True
End If
Any help would be much appreciated - note that I am (very) new to VB and am mostly using trial and error from stuff copied from the net!