ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using VBA to perform a process each row (https://www.excelbanter.com/excel-programming/293615-using-vba-perform-process-each-row.html)

DTM[_2_]

Using VBA to perform a process each row
 
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

--
Message posted from http://www.ExcelForum.com


Frank Kabel

Using VBA to perform a process each row
 
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

--
Regards
Frank Kabel
Frankfurt, Germany

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


---
Message posted from http://www.ExcelForum.com/


DTM[_3_]

Using VBA to perform a process each row
 
Thank you. That seems to do the trick

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:08 PM.

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