Using VBA to perform a process each row

  • Thread starter Thread starter DTM
  • Start date Start date
D

DTM

I would like to check a value in each cell in column L starting at row
to the last row that contains data and perform an action on each ro
that contains a specific value in that cell. How do I find the las
row that contains data and how would I select the rows that contain th
value in the cell I am interested
 
Hi
try the following

Public Sub Foo()
Dim R As Long
Dim lastrow

lastrow = Activesheet.Cells(Rows.Count,"L").End(xlUp).Row
If lastrow < 4 then exit sub
For R = 4 to lastrow
If cells(R,"L").value = "value" Then
'do your action on cells(R,"L")
End If
Next R
end sub
 
Back
Top