ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine Column (https://www.excelbanter.com/excel-programming/334182-determine-column.html)

csbennett

Determine Column
 
I need to loop through all the rows in a spreadsheet and load the data into
various
columns in a table. How do I refer to each column in each row without hard
coding the row number? For instance, in each row I loop through I want to
save off column A into a variable. I need to know how to code that.

Thanks.

Tom Ogilvy

Determine Column
 
for i = 1 to 10
var = cells(i,"A").Value
Next

--
Regards,
Tom Ogilvy

"csbennett" wrote in message
...
I need to loop through all the rows in a spreadsheet and load the data

into
various
columns in a table. How do I refer to each column in each row without

hard
coding the row number? For instance, in each row I loop through I want to
save off column A into a variable. I need to know how to code that.

Thanks.




Bob Phillips[_7_]

Determine Column
 

iLastRow = Cells(Rows.Count,"A").End(xlUp),Row
For i = 1 to iLastRow
myVar = Cells(i,"A").Value
Next i

This is incomplete, as I assume you will do something with myVar, but
hopefully it will get you started.

--
HTH

Bob Phillips

"csbennett" wrote in message
...
I need to loop through all the rows in a spreadsheet and load the data

into
various
columns in a table. How do I refer to each column in each row without

hard
coding the row number? For instance, in each row I loop through I want to
save off column A into a variable. I need to know how to code that.

Thanks.




csbennett

Determine Column
 
Thank you. That helps!

"Bob Phillips" wrote:


iLastRow = Cells(Rows.Count,"A").End(xlUp),Row
For i = 1 to iLastRow
myVar = Cells(i,"A").Value
Next i

This is incomplete, as I assume you will do something with myVar, but
hopefully it will get you started.

--
HTH

Bob Phillips

"csbennett" wrote in message
...
I need to loop through all the rows in a spreadsheet and load the data

into
various
columns in a table. How do I refer to each column in each row without

hard
coding the row number? For instance, in each row I loop through I want to
save off column A into a variable. I need to know how to code that.

Thanks.






All times are GMT +1. The time now is 03:44 AM.

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