1. What I want to do is detect when a user has entered a new row just below the last row of a table.
Some code:
2. Ignoring the specific example above, how can I increment a range, either row or column?
For example:
Have: Range("A5:E10")
Want V1: Range("A5:E11") ' increment by one row
Want V2: Range("A5:F10") ' increment by one column
Want V3: Range("A5:F11") ' increment both
I investigated Range.Offset but I couldn't coax it to do what I wanted.
Thanks...
Some code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim LO As ListObject
Dim rng As Range
Set LO = Me.ListObjects(1) ' This is just an example, assume there could be > 1 table per worksheet
Set rng = LO.Range
'--- I want to increment this range by 1 row
'--- So, if the old range is A1:E5, I want the new range to be A1:E6
' Did the user modify this table, or the first row below the table?
' I need to do one thing if the user A) modified the current table, B) trying to add a new row, or C) editing somewhere else in the worksheet
If Not (Intersect(rng, Target) Is Nothing) Then Debug.Print LO.name
End Sub
2. Ignoring the specific example above, how can I increment a range, either row or column?
For example:
Have: Range("A5:E10")
Want V1: Range("A5:E11") ' increment by one row
Want V2: Range("A5:F10") ' increment by one column
Want V3: Range("A5:F11") ' increment both
I investigated Range.Offset but I couldn't coax it to do what I wanted.
Thanks...