Nlhicks
Active Member
- Joined
- Jan 8, 2021
- Messages
- 264
- Office Version
- 365
- Platform
- Windows
Is there some kind of trick I don't know about that will filter and show the data in the top row (row 2) and the last row?
FindRightRow()
Dim XfmrUpdate As Worksheet, Sheet3 As Worksheet
Dim x As Long
Dim y As Range, z As Range
Dim c As Range
'Dim resp As VbMsgBoxResult
'Dim ans As Variant
'Dim rnData As Range,
Dim Ws As Range
Set XfmrUpdate = Worksheets("Xfmr Update")
Set Sheet3 = Worksheets("Sheet3")
Set Ws = Sheet3.UsedRange
With Sheet3.Range("A1")
If XfmrUpdate.Range("C3").Value <> "" Then .AutoFilter field:=1, Criteria1:="*" & XfmrUpdate.Range("C3") & "*"
If XfmrUpdate.Range("C4").Value <> "" Then .AutoFilter field:=2, Criteria1:="*" & XfmrUpdate.Range("C4") & "*"
Rowz = Application.WorksheetFunction.Subtotal(4, Range("A2:N" & Rows(Rows.Count).End(xlUp).Row))
If Rowz > 0 Then
Worksheets("Xfmr Update").Range("C8").Value = Worksheets("Sheet3").Range("C2:C685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C9").Value = Worksheets("Sheet3").Range("D2:D685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C10").Value = Worksheets("Sheet3").Range("E2:E685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C11").Value = Worksheets("Sheet3").Range("F2:F685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C12").Value = Worksheets("Sheet3").Range("G2:G685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C13").Value = Worksheets("Sheet3").Range("H2:H685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C14").Value = Worksheets("Sheet3").Range("I2:I685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C15").Value = Worksheets("Sheet3").Range("J2:J685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C16").Value = Worksheets("Sheet3").Range("K2:K685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C17").Value = Worksheets("Sheet3").Range("L2:L685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C18").Value = Worksheets("Sheet3").Range("M2:M685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C19").Value = Worksheets("Sheet3").Range("N2:N685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C20").Value = Worksheets("Sheet3").Range("O2:O685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C21").Value = Worksheets("Sheet3").Range("P2:P685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C22").Value = Worksheets("Sheet3").Range("Q2:Q685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C23").Value = Worksheets("Sheet3").Range("R2:R685").SpecialCells(xlCellTypeVisible)
'End If
End With
End Sub
FindRightRow()
Dim XfmrUpdate As Worksheet, Sheet3 As Worksheet
Dim x As Long
Dim y As Range, z As Range
Dim c As Range
'Dim resp As VbMsgBoxResult
'Dim ans As Variant
'Dim rnData As Range,
Dim Ws As Range
Set XfmrUpdate = Worksheets("Xfmr Update")
Set Sheet3 = Worksheets("Sheet3")
Set Ws = Sheet3.UsedRange
With Sheet3.Range("A1")
If XfmrUpdate.Range("C3").Value <> "" Then .AutoFilter field:=1, Criteria1:="*" & XfmrUpdate.Range("C3") & "*"
If XfmrUpdate.Range("C4").Value <> "" Then .AutoFilter field:=2, Criteria1:="*" & XfmrUpdate.Range("C4") & "*"
Rowz = Application.WorksheetFunction.Subtotal(4, Range("A2:N" & Rows(Rows.Count).End(xlUp).Row))
If Rowz > 0 Then
Worksheets("Xfmr Update").Range("C8").Value = Worksheets("Sheet3").Range("C2:C685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C9").Value = Worksheets("Sheet3").Range("D2:D685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C10").Value = Worksheets("Sheet3").Range("E2:E685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C11").Value = Worksheets("Sheet3").Range("F2:F685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C12").Value = Worksheets("Sheet3").Range("G2:G685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C13").Value = Worksheets("Sheet3").Range("H2:H685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C14").Value = Worksheets("Sheet3").Range("I2:I685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C15").Value = Worksheets("Sheet3").Range("J2:J685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C16").Value = Worksheets("Sheet3").Range("K2:K685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C17").Value = Worksheets("Sheet3").Range("L2:L685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C18").Value = Worksheets("Sheet3").Range("M2:M685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C19").Value = Worksheets("Sheet3").Range("N2:N685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C20").Value = Worksheets("Sheet3").Range("O2:O685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C21").Value = Worksheets("Sheet3").Range("P2:P685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C22").Value = Worksheets("Sheet3").Range("Q2:Q685").SpecialCells(xlCellTypeVisible)
Worksheets("Xfmr Update").Range("C23").Value = Worksheets("Sheet3").Range("R2:R685").SpecialCells(xlCellTypeVisible)
'End If
End With
End Sub