?
Solved

What is the maximum number of columns VB Script will read

Posted on 2013-01-24
4
Medium Priority
?
449 Views
Last Modified: 2013-02-08
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)
0
Comment
Question by:jeremyzit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 70

Expert Comment

by:Qlemo
ID: 38816543
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?
0
 
LVL 56

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 38817090
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
Next
For iCol = 1 To 1000
   sTest = oSheet.Cells(1, iCol).Value
   If sTest <> iCol Then Wscript.Echo iCol
Next
oExcel.Quit

Open in new window

~bp
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 38818444
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.
0
 

Author Comment

by:jeremyzit
ID: 38818648
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question