I have a table that retrieves a list of available reports to the user. The user then enters an ‘X’ in a specific column next to the report they wish to generate.
How do I iterate through each available row and work out if the user has entered ‘X’?
A | B | C | D 001 | REPORT A | fnReportA | X 002 | REPORT B | fnReportB | <NULL> 003 | REPORT C | fnReportC | <NULL>
How do I iterate through each row when the list is retrieved and put a BUTTON at the end of each row that links to the vba to generate the report?
For Each will do the type of search you are looking to do
A quick example:
Option Explicit Sub testit() Dim c As Range For Each c In Range("D2:D10").Cells If c.Value = "X" Then Debug.Print c.Row End If Next End Sub
This will print the row number of each cell that has an X.