ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   read the values from a excel row (https://www.excelbanter.com/excel-programming/393276-read-values-excel-row.html)

shantanu

read the values from a excel row
 
hi
I am trying to read the values from a excel row. There are 89
columns for each row and same number of data in each rows.
Kindly help

regards
shantanu


NickHK

read the values from a excel row
 
Depend what you are doing and what you mean by "read", but here's one way:

Dim Vals As Variant
Vals = Range(Cells(1, 1), Cells(1, 89)).Value
'Note you get a 2-D array even for one row
Debug.Print Vals(1, 29)

Maybe look at Transpose also.

Also, if you must post to more than one NG, cross-post, not multi-post. If
this means nothing to you, read:
http://www.cs.tut.fi/~jkorpela/usenet/xpost.html

NickHK

"shantanu" wrote in message
ups.com...
hi
I am trying to read the values from a excel row. There are 89
columns for each row and same number of data in each rows.
Kindly help

regards
shantanu




OssieMac

read the values from a excel row
 
Not really sure what you are trying to achieve but the following example
gives a simplistic way of reading the data and displaying in a message box so
perhaps it will give you a lead on what you need to do. You indicated that
the number of columns is fixed and the following sets the number of columns
but can have any number of rows and stops when it does not find any more data
in the first column of a row.

Sub Read_Cell_Values()
Dim rowNumber
Dim firstColumn
Dim numbColumns

rowNumber = 2 'Set to match the first row of your data
firstColumn = 1 'Set to match first column number with data
numbColumns = 89 'Set to number of columns of data

Do While Len(Trim(Cells(rowNumber, firstColumn))) < 0
For i = firstColumn To numbColumns
MsgBox Cells(rowNumber, i).Value
Next i
rowNumber = rowNumber + 1
Loop

End Sub

Regards,

OssieMac


"shantanu" wrote:

hi
I am trying to read the values from a excel row. There are 89
columns for each row and same number of data in each rows.
Kindly help

regards
shantanu




All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com