sspatriots
Well-known Member
- Joined
- Nov 22, 2011
- Messages
- 585
- Office Version
- 365
- Platform
- Windows
Good afternoon,
I have a situation where I've tried both methods below to create a table on a worksheet that starts in row 2 for the headers. The problem is that in the middle of the list of data, there are three rows with no data in the first 10 table cells (or so). When I try the first method below, I get my headers on row 2, but it only captures data for the table to the rows of the table that have blanks in the first 10 table cells (or so). When I use the ".CurrentRegion" method, I can't make it start at row 2 for the headers, however, it does capture every row in the set of data when creating the table.
Any recommendations would be greatly appreciated.
Thanks, SS
Attempt using "Range(.End(xlDown)" method:
Attempt using ".CurrentRegion" method:
I have a situation where I've tried both methods below to create a table on a worksheet that starts in row 2 for the headers. The problem is that in the middle of the list of data, there are three rows with no data in the first 10 table cells (or so). When I try the first method below, I get my headers on row 2, but it only captures data for the table to the rows of the table that have blanks in the first 10 table cells (or so). When I use the ".CurrentRegion" method, I can't make it start at row 2 for the headers, however, it does capture every row in the set of data when creating the table.
Any recommendations would be greatly appreciated.
Thanks, SS
Attempt using "Range(.End(xlDown)" method:
VBA Code:
If TableExists(Worksheets("COMM - In Production"), "COMM_In_Production") Then
' MsgBox "Table1 Exists on sheet " & ActiveSheet.Name
Else
' MsgBox "Table1 Does Not Exist on sheet " & ActiveSheet.Name
With Worksheets("COMM - In Production").Range("A2")
.Parent.ListObjects.Add(xlSrcRange, Range(.End(xlDown), .End(xlToRight)), , xlYes).Name = "COMM_In_Production"
End With
End If
Attempt using ".CurrentRegion" method:
VBA Code:
If TableExists(Worksheets("COMM - In Production"), "COMM_In_Production") Then
' MsgBox "Table1 Exists on sheet " & ActiveSheet.Name
Else
' MsgBox "Table1 Does Not Exist on sheet " & ActiveSheet.Name
With Worksheets("COMM - In Production").Range("A2")
.Parent.ListObjects.Add(xlSrcRange, Range("A2").CurrentRegion, , xlYes).Name = "COMM_In_Production"
End With
End If