Find row number of last value in column

  • Thread starter Thread starter Darren \(at work\)
  • Start date Start date
D

Darren \(at work\)

Hi,
I have a column in which the number of rows will always change. What i
need to do is determine the Row number in which the last value is placed.

The code I am using, for testing, is this:

====Begin Code=========================

'--Loop down through all entries for "Fault Type"

For i = 2 To 85

'--Number of item inspected. Those with more than one fault,
'--The item number will be in a merged cell, the value sitting in the
'--topmost cell. If there are any rows with an Item number missing
'--then do not take the corresponding fault type from respective column.

If Cells(i, 8).Value <> "" Then
Select Case Cells(i, 10).Value
Case "Paint Fault"
intPaintFault = intPaintFault + 1
Case "Misc"
intMisc = intMisc + 1
Case "Scratch"
intScratch = intScratch + 1
Case "Plastic Sheild"
intPlasticShield = intPlasticShield + 1
Case "Dent", "Indent"
intDents = intDents + 1
Case "Paint Chip"
intPaintChip = intPaintChip + 1
Case "Bent"
intBent = intBent + 1
End Select
End If
Next i
====End Code==========================

What I need for the top limit of the for loop is the row number of the
bottom most cell with a vlue in it, as oposed to an absolute number.

Hope this makes sense.

Best Regards
Darren
 
Darren (at work),

Assuming you are testing column 8, or H in worksheet speak, try this

cLastRow = Cells(Rows.Count,"H").End(xlUp).Row

You can just as easily use 8 as H.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
| Darren (at work),
|
| Assuming you are testing column 8, or H in worksheet speak, try this
|
| cLastRow = Cells(Rows.Count,"H").End(xlUp).Row
|
| You can just as easily use 8 as H.
|

Thanks Bob, thats exactly what I was looking for.

Many thanks.

Darren
 
Back
Top