VBA List current active projects per person from Table

7thwave

New Member
Joined
Mar 23, 2018
Messages
4
Excellists,

I have a table in sheet1 of workbook as shown below. Ik want to add a Command_button that shows a list active projects (Column = Status = WIP) per person (Column = BC = Naam1 or Naam2 or Naam3 etc.). The result could be a msgbox or a listbox; i don't really care. To start i need to define the number of rows in the table (to then code something like: For Each cell In sht.Range("A2:A" & LastRow). My attempt to determine the number of rows fails. What am i doing wrong?

Code:
Sub BClist()
Dim myWorkSheet As Worksheet, myTable As ListObject, countRows As Long
    Set myWorkSheet = ActiveWorkbook.Worksheets("Sheet1")
    Set myTable = myWorkSheet.ListObjects("Table1")
    countRows = myTable.DataBodyRange.Rows.Count
    Debug.Print countRows
End Sub

Tyvm for you thoughts,

Luc


ABCDEBCGHStatus
16-1-2014 Klant1 € 150.000Naam1 23-02-17WIP
29-3-2016 Klant2 € 100.000Naam2 24-02-17WON
38-1-2016 Klant3 € 100.000Naam3 13-06-16WON
420-7-2017 Klant4 € 150.000Naam1 27-07-17WON
528-9-2015 Klant5 € 1.000.000Naam2 25-04-17WIP
621-12-2016 Klant6 € 500.000Naam3 10-01-17WON
722-12-2016 Klant7 € 250.000Naam1 WIP
823-12-2016 Klant8 € 500.000Naam2 7-08-17LOST
924-12-2016 Klant9 € 250.000Naam3 WIP
108-8-2014 Klant10 € 3.000.000naam4 12-07-16LOST

<colgroup><col><col><col span="2"><col><col><col><col span="2"></colgroup><tbody>
</tbody>
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top