Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi guys I would like to know how to sustitute the "Columns(4).Rows.Count"
statement for something more efficient, the Idea is to know in wich cell I find the last record, instead off read all the column , there are no empty cells in between, I had to assign Long to "i" because I got an overflow with byte or integer. Thanks Dim i As Long, j As Integer For j = 1 To 10 For i = 1 To Columns(4).Rows.Count If Cells(i, 4) = Cells(j, 1) Then Cells(i, 5) = Range("Especias")(j, 2).Value End If Next i Next j End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can get the last row for that column with
lr4 = Cells(rows.Count, 4).End(xlUp).Row And then just plug it into For i = 1 To lr4 The way you have it would equal 1 To 65356. With the lr4 it will only go to the last row in that column with data. "Orlando" wrote: Hi guys I would like to know how to sustitute the "Columns(4).Rows.Count" statement for something more efficient, the Idea is to know in wich cell I find the last record, instead off read all the column , there are no empty cells in between, I had to assign Long to "i" because I got an overflow with byte or integer. Thanks Dim i As Long, j As Integer For j = 1 To 10 For i = 1 To Columns(4).Rows.Count If Cells(i, 4) = Cells(j, 1) Then Cells(i, 5) = Range("Especias")(j, 2).Value End If Next i Next j End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count rows with criteria from two columns? | Excel Worksheet Functions | |||
Excel 2003 - change columns to rows and rows to columns | Excel Discussion (Misc queries) | |||
Excel 2003 - change columns to rows and rows to columns | Excel Discussion (Misc queries) | |||
Count entries in columns and rows | Excel Worksheet Functions | |||
Reduce columns and rows count? | Excel Worksheet Functions |