sspatriots
Well-known Member
- Joined
- Nov 22, 2011
- Messages
- 585
- Office Version
- 365
- Platform
- Windows
I can't seem to get my second table's number of rows to match the first table that I'm referencing. Below is what I have so far, however, I keep getting a "Compile error: Type mismatch". Any suggestions would be greatly appreciated. Thanks, SS
VBA Code:
Dim wb1 As Workbook
Dim ws1, ws2 As Worksheet
Dim tb1, tb2 As ListObject
Dim rng1, rng2, rng3 As Range
Dim cl As Range
Dim numRows As Long
' Dim numRows2 As Long
With Application
.EnableEvents = False
.ScreenUpdating = False
' .CutCopyMode = False
' .DisplayAlerts = False
.Calculation = xlCalculationManual
End With
Set wb1 = ThisWorkbook
Set ws1 = wb1.Worksheets("2024")
Set ws2 = wb1.Worksheets("PO File Paths")
Set tb1 = ws1.ListObjects("Table4711")
Set tb2 = ws2.ListObjects("POHLINKCNV")
Set rng1 = Range("POHLINKCNV[Full PO '#]")
Set rng2 = Range("POHLINKCNV[Hyperlink]")
Sheets("PO File Paths").Select
With Range("FilePathRange")
.ClearContents
.ClearFormats
.ClearHyperlinks
End With
numRows = tb1.ListRows.Count
Set rng3 = tb2.Resize(numRows, 2)
ws2.tb2.Resize rng3
End Sub