Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parameterize Excel Columns for 2-Dimensional Array
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Guys

I'm trying copy data from a 2-dimensional array into an Excel sheet but the problem I'm having is how can I move to the next column of the Excel sheet using a For Loop to go through the array.

The excel sheet columns are labelled "A","B" etc, how can I move to the next column without having to write a statement for each column.
.
.
.
Code:
For i=0 to Some_value
  For j= 0 to Some_value
    objWorkSheet.cells(i+1, "A")=MyArray(i,j)
   Next
Next
.

The rows are fine because they're a parameter of the For Loop but how can I parameterize the columns so I can use j to keep track of the column.
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi,
Instead of specifying the column label use column number to pass the values
for ex:
Code:
For i=0 to Some_value
  For j= 0 to Some_value
    objWorkSheet.cells(i+1, [color=#FF0000]j+1[/color])=MyArray(i,j)
   Next
Next

Let me know in case of any help required.

Regards,
Sankalp
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Thanks for your input, will using the column number work without me going into preferences to make Excel show column numbers instead of letters?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Identify and Count the columns in the datatable Bhuvana 0 818 12-20-2019, 11:15 PM
Last Post: Bhuvana
  How To Capture Array Value into Excel Worksheet? Studymode 0 1,302 01-09-2018, 08:37 AM
Last Post: Studymode
  parameterize Excel Sheet Name in SQL bjitsidhu 0 2,729 07-20-2014, 08:34 AM
Last Post: bjitsidhu
  Comparing two excel Sheets whose columns names vary Divya Roopa 2 8,257 03-26-2014, 07:20 PM
Last Post: Parke
  sort two dimensional array. venkatesh9032 0 1,735 03-06-2014, 02:47 PM
Last Post: venkatesh9032

Forum Jump:


Users browsing this thread: 2 Guest(s)