Beneindias
Board Regular
- Joined
- Jun 21, 2022
- Messages
- 120
- Office Version
- 365
- Platform
- Windows
- MacOS
Hi all,
I have vba code to update the workbook when there are changes in a table.
My problem is that if I add a row to the table, it calls the code and updates the workbook, but if I delete a row, nothing hapens.
My code is this on:
So, this is working when I add a row, but not when I delete a row.
Is there a way to change this, or do I need to find another solution?
Thnak you all
I have vba code to update the workbook when there are changes in a table.
My problem is that if I add a row to the table, it calls the code and updates the workbook, but if I delete a row, nothing hapens.
My code is this on:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim col As Range
'Sets range to column "Código" in table "Obras"
Set col = ListObjects("Obras").ListColumns("Código").Range
'Checks if cell is inside range of column "Código"
If Not Intersect(col, Target) Is Nothing Then
'Selection IS inside the range.
ThisWorkbook.RefreshAll
End If
End Sub
So, this is working when I add a row, but not when I delete a row.
Is there a way to change this, or do I need to find another solution?
Thnak you all