Hello to all, very new to vba and starting to learn macros.
I have macros that are saved inside each sheet in my workbook via Worksheet_Calculate()
I was able to refer to workbook where the code is save using "ThisWorkbook"
Also to the sheet where the code is save using "Sheets(Me.Name)"
Q1 - How can I refer to the table where the code is save? I have about 90 sheets in my workbook and each sheet has 1 table inside.
Q2 - Once I identified the table, How can I auto resize it using CountifA function I put in cell B1. My range starts with cell A5 and end at cell J(value of cell B1).
Kindly refer to the code below. Thanks.
Private Sub Worksheet_Calculate()
Dim wks As Worksheet
Set wks = ThisWorkbook.Sheets(Me.Name)
wks.ListObjects("Table Name").Resize Range("$A$5:$J(value of cell B1)")
End Sub
Bookmarks