What is the maximum number of columns VB Script will read

What is the maximum number of columns VB Script will read data from? I've got a spread sheet that has data in 180 columns and it stops reading the data at the 120th column. It returns null for column 121 to 180.

sTest = Worksheets("TEST").Cells(iRow, 132)
Who is Participating?
Bill PrewConnect With a Mentor Commented:
In the event that you are working in VBS and using automation to Excel, here's a simple example showing that columns 1 to 1000 were accessed and returned the correct values.  So there isn't a limit at 120.

Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)
For iCol = 1 To 1000
   oSheet.Cells(1, iCol).Value = iCol
For iCol = 1 To 1000
   sTest = oSheet.Cells(1, iCol).Value
   If sTest <> iCol Then Wscript.Echo iCol

Open in new window

This is VBA (Visual Basic for Application), not VBS (VB Script), as you are inside of Excel.
And there is no limitation on columns (besides the 65535 of less recent Excel releases).

Could you prepare an example sheet with a few rows, including the code you use to read?
Patrick MatthewsCommented:
Concur with the above.

An Excel 2003 or earlier worksheet has 256 columns, and an Excel 2007+ worksheet has 16,384 columns.

Assuming you have the right version of Excel and valid code, all columns are accessible from VBScript.
jeremyzitAuthor Commented:
I'm using Excel 2003 and it's VBA coding that I'm using since it's inside excel. I was mistaken that it was vb script. I'll try to get an example sheet put on today along with some code.
All Courses

From novice to tech pro — start learning today.