sspatriots
Well-known Member
- Joined
- Nov 22, 2011
- Messages
- 585
- Office Version
- 365
- Platform
- Windows
Hi,
I'm trying to use a macro I found here in this group, but with a slight modification. I have multiple tables on the same worksheet called "Drops" that I want to resize with the same macro. Column A2:A14 consist of the worksheets table names and column B2:B14 consist of the corresponding number of rows that I want to resize all of these tables to. I've added a variable to capture the table name from column A, using the variable named "tbName1". However, I'm having trouble replacing "Table1" in the code with "tbName1". Any assistance would be greatly appreciated.
Thanks, SS
I'm trying to use a macro I found here in this group, but with a slight modification. I have multiple tables on the same worksheet called "Drops" that I want to resize with the same macro. Column A2:A14 consist of the worksheets table names and column B2:B14 consist of the corresponding number of rows that I want to resize all of these tables to. I've added a variable to capture the table name from column A, using the variable named "tbName1". However, I'm having trouble replacing "Table1" in the code with "tbName1". Any assistance would be greatly appreciated.
Thanks, SS
VBA Code:
Sub ResizeTables()
Dim rng1 As Range
Dim tb1 As ListObject
Dim tbName1 As String
tbName1 = Range("A8")
Set rng1 = Range("Table1[#All]").Resize(Range("B8").Value)
Set tb1 = ActiveSheet.ListObjects("Table1")
tb1.Resize rng1
End Sub