chazzerman01
Board Regular
- Joined
- Nov 18, 2019
- Messages
- 65
is it possible for a macro to run if the active cell value is different to the value above it
Sub Resize_Me()
'Modified 1/8/2020 9:36:27 AM EST
Dim rng As Range
Dim ans As Long
ans = InputBox("How Many Rows")
Dim tbl As ListObject
Set tbl = ActiveSheet.ListObjects("Table6")
Set rng = Range("Table6[#All]").Resize(tbl.Range.Rows.Count + ans, tbl.Range.Columns.Count)
tbl.Resize rng
Range("Table6[#All]").Select
End Sub
Dim tbl As ListObject
Set tbl = ActiveSheet.ListObjects("Table 6")
If Not Application.Intersect(Target, tbl.ListRows(tbl.ListRows.Count).Range(1, 1)) Is Nothing Then
End If
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified 1/8/2020 10:27:51 AM EST
Dim tbl As ListObject
Set tbl = ActiveSheet.ListObjects("Table6")
If Not Application.Intersect(Target, tbl.ListRows(tbl.ListRows.Count).Range(1, 1)) Is Nothing Then
Application.EnableEvents = False
Call Resize_Me
End If
Application.EnableEvents = True
End Sub
See my latest postYes (although I tend to select "Worksheet" and "Change" from the drop-downs at the top of the editor pane, and it puts in that line and the End Sub line automatically).
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified 1/8/2020 10:27:51 AM EST
Dim tbl As ListObject
Set tbl = ActiveSheet.ListObjects("Table6")
If Not Application.Intersect(Target, tbl.ListRows(tbl.ListRows.Count).Range(1, 1)) Is Nothing and Target.Value<>"" Then
Application.EnableEvents = False
Call Resize_Me
End If
Application.EnableEvents = True
End Sub