Dim wk As Worksheet Set wk = Worksheets("foglio2") ur = Range("A" & Rows.Count).End(xlUp).Row For j = 1 To ur If Cells(j, 1).EntireRow.Hidden = True Then ur1 = wk.Range("A" & Rows.Count).End(xlUp).Row + 1 Cells(j, 1).EntireRow.Copy wk.Range("A" & ur1).PasteSpecial xlPasteValues end if next
Option Explicit Sub Nascondi() Application.ScreenUpdating = False Dim NRc As Long, x As Long, y As Long Dim Vlr As Byte Dim Rng As Range NRc = Range("A" & Rows.Count).End(xlUp).Row Set Rng = Range(Cells(1, 3), Cells(NRc, 7)) Range(Cells(1, 1), Cells(NRc, 1)).EntireRow.Hidden = True Vlr = InputBox("Digitare il numero da valutare compresa tra 1 e 90") For x = 1 To NRc If Not Application.WorksheetFunction.CountIf(Range("A" & x & ":C" & x), Vlr) = 0 Then Cells(x, 1).EntireRow.Hidden = False Else y = y + 1 Range(Cells(x, 1), Cells(x, 5)).Copy Sheets("Foglio2").Cells(y, 1).PasteSpecial Paste:=xlPasteValues End If Next x Application.CutCopyMode = False Application.ScreenUpdating = True End Sub
gattodimarmo1980, 25/08/2019 13.28:.... Nel foglio2 devono essere riportate le righe nascoste cioè quelle che già sto vedendo nel foglio1.
Sub riporta() Application.ScreenUpdating = False Dim Ur As Long, K As Long, ur1 As Long Dim wk As Worksheet Set wk = Worksheets("foglio2") Ur = Range("A" & Rows.Count).End(xlUp).Row For K = 1 To Ur If Cells(K, 1).EntireRow.Hidden = False Then ur1 = wk.Range("A" & Rows.Count).End(xlUp).Row + 1 Cells(K, 1).EntireRow.Copy wk.Range("A" & ur1).PasteSpecial xlPasteValues End If Next K Application.CutCopyMode = False Application.ScreenUpdating = True Set wk = Nothing End Sub
gattodimarmo1980, 10/11/2019 11.08:Buona Domenica nel foglio1 ho tre macro la macro Visualizza e la macro Nascondi funzionano perfettamente.La Macro Riporta non funziona dovrei riportare con questa nel foglio2 solo le righe che visualizzo dopo averle nascoste.Grazie anticipatamente Matteo. Allego un foglio nuovo è cambiato il range e non riesco a modificarlo.