neodjandre
Well-known Member
- Joined
- Nov 29, 2006
- Messages
- 950
- Office Version
- 2019
- Platform
- Windows
Hi all, I have a listobject as seen on the screenshot.
I am looking to add items in an array provided that column "On/off" has value "On" and column "§" does not contain the letters "I" or "T".
So in my example the array would contain a single column with just the values:
Kiwis
Strawberries
So far I have come up with this code:
But I am not sure how to loop through both of the requirements at the same time. Any ideas would be much appreciated!
I am looking to add items in an array provided that column "On/off" has value "On" and column "§" does not contain the letters "I" or "T".
So in my example the array would contain a single column with just the values:
Kiwis
Strawberries
So far I have come up with this code:
VBA Code:
Sub mytable_to_array()
Dim myTable As ListObject
Dim myArray As Variant
Dim x As Long
Set myTable = ActiveSheet.ListObjects("Table1")
myArray = myTable.DataBodyRange
For x = LBound(myArray) To UBound(myArray)
Debug.Print myArray(x, 2)
Next x
End Sub
But I am not sure how to loop through both of the requirements at the same time. Any ideas would be much appreciated!