R
R.VENKATARAMAN
extract of my code
Dim i As Integer
Dim j As Integer
Dim sh As Worksheet
Set sh = ThisWorkbook.Worksheets("sheet2")
Dim mysectors As Range
Dim sector1 As Range
Dim sectorlast As Range
Set sector1 = sh.Range("c2")
Set sectorlast = sh.Range("c2").End(xlDown)
Set mysectors = Range(sector1, sectorlast)
j = WorksheetFunction.CountA(mysectors)
MsgBox j
Dim wkbk() As String****************
Dim mypath As String
mypath = "e:\temporary\choksey\choksey 18-10\"
For i = 1 To j
wkbk(i) = mypath & Sheet2.Range("c2").Offset(i - 1, 0) & ".xls"
with this code when I come to the last statement error "subscript out of
range" comes
But if amend the stament marked *******as <dim wkbk(16) as string>
it works.
My problem is the the array dimension changes.
instead of having wkbk() as dynamic aarray can I give a larger value for
dimension for e.g
wkbk(50) and use only 15 or 16 or 20 wkbk()
or any other soluton
thanks and regards.
Dim i As Integer
Dim j As Integer
Dim sh As Worksheet
Set sh = ThisWorkbook.Worksheets("sheet2")
Dim mysectors As Range
Dim sector1 As Range
Dim sectorlast As Range
Set sector1 = sh.Range("c2")
Set sectorlast = sh.Range("c2").End(xlDown)
Set mysectors = Range(sector1, sectorlast)
j = WorksheetFunction.CountA(mysectors)
MsgBox j
Dim wkbk() As String****************
Dim mypath As String
mypath = "e:\temporary\choksey\choksey 18-10\"
For i = 1 To j
wkbk(i) = mypath & Sheet2.Range("c2").Offset(i - 1, 0) & ".xls"
with this code when I come to the last statement error "subscript out of
range" comes
But if amend the stament marked *******as <dim wkbk(16) as string>
it works.
My problem is the the array dimension changes.
instead of having wkbk() as dynamic aarray can I give a larger value for
dimension for e.g
wkbk(50) and use only 15 or 16 or 20 wkbk()
or any other soluton
thanks and regards.