jjmalloy82
New Member
- Joined
- Apr 17, 2015
- Messages
- 10
I have a code (below) that is doing the original intent. However, I am wondering if there is a way to only pull the first 20 lines of data.
What I would think would be awesome is if:
Let's say on the Dashboard I select the Country "United States" and I also select "Business Unit". I would like for the code to only pull the first 20 lines of data that meet those two conditions.
As you can see below I have my data set up to sort and then pull the data over, what I would like is to be able to sort just as below but add conditions....if I have 40 rows of data and 25 of those meet my two conditions I want the first 20 results to appear on my Dashboard.
What I would think would be awesome is if:
Let's say on the Dashboard I select the Country "United States" and I also select "Business Unit". I would like for the code to only pull the first 20 lines of data that meet those two conditions.
As you can see below I have my data set up to sort and then pull the data over, what I would like is to be able to sort just as below but add conditions....if I have 40 rows of data and 25 of those meet my two conditions I want the first 20 results to appear on my Dashboard.
Code:
Sub TechReview()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim ws2 As Worksheet
Set ws = Sheets("Dashboard")
Set ws2 = Sheets("Status")
Range("E15:E35").Select
Selection.NumberFormat = "0.00"
ws.Range("D11").Value = "Assessor"
ws.Range("E11").Value = "Tech Reviewer"
ws.Range("F11").Value = "Due Date"
ws.Range("G11").Value = "Status"
Sheet8.Visible = xlSheetVisible
Sheet8.Select
Sheet8.Range("A4:cc1000").Select
Selection.Sort Key1:=Range("AR2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ws.Select
Sheet8.Visible = xlSheetVeryHidden
'----------------------------------
'COPIES 20 LINES OF DATA
ws.Range("B13:C13").Resize(20).Value = ws2.Range("A4:B4").Resize(20).Value
ws.Range("D13").Resize(20).Value = ws2.Range("AD4").Resize(20).Value
ws.Range("E13").Resize(20).Value = ws2.Range("AI4").Resize(20).Value
ws.Range("F13").Resize(20).Value = ws2.Range("AR4").Resize(20).Value
ws.Range("G13").Resize(20).Value = ws2.Range("T4").Resize(20).Value
ws.Range("A1").Select
End Sub