Hello,
I am trying to increment through columns within a set of rows. My sequence is:
1. Increment through Rows of the range
2. Within each row, increment through the column of the selected row and grab the value of each column till the last column.
I am stuck in incrementing through the column without hardcoding of the column number.
Here is what I have so far:
I know my start row, end row, start column which is always 1, and end column. Is there a way to avoid typing icol+1, iCol+2, iCol+3 so on and so forth and incrementing till it hits the last column which is captured by the variable varLastColumn,
For iRow = varStartRow To varEndRow 'Loop through the Downloaded_Orders Sheet
For iCol = 1 To varLastColumn
'Values in Worksheet - Downloaded_Orders to copy from
varStatus = .Cells(iRow, iCol + 1).Value
varStatusDate = .Cells(iRow, iCol + 1).Value
varBatch_Name = .Cells(iRow, iCol + 2).Value
varOrderNumber = .Cells(iRow, iCol + 3).Value
varItem_Code = .Cells(iRow, iCol + 4).Value
varAmount = .Cells(iRow, iCol + 5).Value
varAmountUnitType = .Cells(iRow, iCol + 6).Value
varIncentiveDate = .Cells(iRow, iCol + 7)
varQuantity = .Cells(iRow, iCol + 8).Value
varProduct_Name = .Cells(iRow, iCol + 9).Value
....................................
Next
Next
Your feedback is appreciated.
Thanks.
Bookmarks