?
Solved

What is the maximum number of columns VB Script will read

Posted on 2013-01-24
4
Medium Priority
?
453 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 71

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 58

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

650 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