Hi all!
I was trying to make use of table/list functionality (filtering and referencing) while looping. I was thinking it might allow for something more efficient /elegant than what we have which loops through every row with if/then statements.
I am starting to think I am making it more confusing than it has to be...am I missing a key that would simplify things?
I have a table with 18 columns established. For rows where the Title (col 8) is blank, I want to call an external source to get 3 values and then insert them in the appropriate columns for that record.
' Filter TPR list for where title (col 8) is blank - macro recording gave me this
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=8, Criteria1:="="
'I used Intersect and specialcells-visible to get list of TPRs (in Col B) ---is there a better way???
For Each TPRnum In Intersect(ActiveSheet.ListObjects("Table1").Range.SpecialCells(xlCellTypeVisible), Range("B29:B529"))
strTitle = GetFieldValue(TPRnum, "Title")
strStatus = GetFieldValue(TPRnum, "Status")
strSeverity = GetFieldValue(TPRnum, "Severity")
'now need to insert back to row- example- I havent tried this out...
Activesheet.Range("R" & TPRnum.row & "C8") = strTitleDate
Next TPRnum
'Undo Filter
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=8
Have I missed any way to reference table columns or rows in VBA in a clearer way?
I was trying to make use of table/list functionality (filtering and referencing) while looping. I was thinking it might allow for something more efficient /elegant than what we have which loops through every row with if/then statements.
I am starting to think I am making it more confusing than it has to be...am I missing a key that would simplify things?
I have a table with 18 columns established. For rows where the Title (col 8) is blank, I want to call an external source to get 3 values and then insert them in the appropriate columns for that record.
' Filter TPR list for where title (col 8) is blank - macro recording gave me this
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=8, Criteria1:="="
'I used Intersect and specialcells-visible to get list of TPRs (in Col B) ---is there a better way???
For Each TPRnum In Intersect(ActiveSheet.ListObjects("Table1").Range.SpecialCells(xlCellTypeVisible), Range("B29:B529"))
strTitle = GetFieldValue(TPRnum, "Title")
strStatus = GetFieldValue(TPRnum, "Status")
strSeverity = GetFieldValue(TPRnum, "Severity")
'now need to insert back to row- example- I havent tried this out...
Activesheet.Range("R" & TPRnum.row & "C8") = strTitleDate
Next TPRnum
'Undo Filter
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=8
Have I missed any way to reference table columns or rows in VBA in a clearer way?