I have the error 91 in VBA
with the following code:
Dim i, c, b, a,
With wsMissingSCM2.ListObjects("tblReportData2")
.TableStyle = "TableStyleLight6"
'
' LocationColumn
'
i = 1
.ListColumns(i).DataBodyRange.HorizontalAlignment = xlCenter 'ERROR HERE
.HeaderRowRange.Columns(i).Value = "Missing Item"
.ListColumns(i).DataBodyRange.ColumnWidth = 14
Any suggestion?
When you define the property
.DataBodyRange.HorizontalAlignment
it does not know which object you want to make it to since you made another assignment before,i = 1
for that reason you get the error With block variable not set (Error 91) :Change your code, first setting the properties of
wsMissingSCM2.ListObjects("tblReportData2")
and then the value ofi
: