I can't figure our why I get error '9'. I declared the string array, then I would like to use the array values to set the sheet names. What I'm doing wrong?
Dim wsText() As String
Dim sht As Worksheet
Dim wSum As Worksheet
Dim service As String
Dim supplier As String
Dim priceRange As String
Dim price As String
Dim Lrow As Integer, LastRow As Integer
Set sht = ThisWorkbook.Worksheets(4)
Set wSum = ThisWorkbook.Worksheets(Summary)
wsText = Array("<25K", "25K <100K", "100K <250K", "250K <500K", "500K <1M", "1M <5M", "5M <15M", "15M <30M", "30M <50M")
LastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row
For Each element In wsText
For i = 5 To LastRow
For j = 13 To 47
Lrow = wSum.UsedRange.Rows(wSum.UsedRange.Rows.Count).Row + 1
service = ThisWorkbook.Worksheets(element.Value).Cells(i, 1).Text
supplier = ThisWorkbook.Worksheets(element.Value).Cells(4, j).Text
priceRange = ThisWorkbook.Worksheets(element.Value).Cells(2, 1).Text
price = ThisWorkbook.Worksheets(element.Value).Cells(i, j).Text
wSum.Cells(Lrow, 1) = service
wSum.Cells(Lrow, 2) = supplier
wSum.Cells(Lrow, 3) = priceRange
wSum.Cells(Lrow, 4) = price
Next j
Next i
Next element
End Sub