Automatically Populate Worksheet Depending on Team Name
On my first worksheet "Ws1" I have a table of data. Column A has Team Name
and Column B has Item Num. On worksheet 2 I have a blank worksheet "Ws2" that I would like to automatically populate with data from "Ws1" when a team is selected from a list box "LB1" and a button is clicked "VR1". I only want to select from 'Ws1" and display in "Ws2" those rows where the team name is equal to the team name selected in the listbox. "Ws2" has the same column headers. Thanks. |
Automatically Populate Worksheet Depending on Team Name
Sub getteams()
teamname = Sheets("WS2").LB1.Value WS2RowCount = 2 With Sheets("Ws1") LastRow = .Range("A" & Rows.Count).End(xlUp).Row For WS1RowCount = 2 To LastRow If .Range("A" & WS1RowCount) = teamname Then .Rows(WS1RowCount).Copy _ Destination:=Sheets("WS2").Rows(WS2RowCount) WS2RowCount = WS2RowCount + 1 End If Next WS1RowCount End With End Sub "Qaspec" wrote: On my first worksheet "Ws1" I have a table of data. Column A has Team Name and Column B has Item Num. On worksheet 2 I have a blank worksheet "Ws2" that I would like to automatically populate with data from "Ws1" when a team is selected from a list box "LB1" and a button is clicked "VR1". I only want to select from 'Ws1" and display in "Ws2" those rows where the team name is equal to the team name selected in the listbox. "Ws2" has the same column headers. Thanks. |
All times are GMT +1. The time now is 12:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com