Hirdetés

Keresés

Új hozzászólás Aktív témák

  • eszgé100

    őstag

    válasz Fferi50 #47925 üzenetére

    A fájl szűrés nélküli állapotban nyílik meg, és a manual update értéke ''no".
    Ha kézzel átállítom "yes"-re függetlenül attól, hogy szűrtem-e, akkor alábbi kóddal tudtam megoldani, de nem vagyok benne biztos, hogy jól csináltam.

    Set scrange = ws.UsedRange.Columns("D").SpecialCells(xlCellTypeVisible).Find(what:=sPath, after:=Range("D" & counter))
    cntifres = WorksheetFunction.CountIfs(ws.Range("D2 : D" & lastrow), scrange, ws.Range("P2 : P" & lastrow), "yes")

    If cntifres = 0 Then
    If scrange.Row <= counter Then
    Excel.Workbooks(fileName).Close SaveChanges:=True
    ElseIf manualcheck = False & CStr(saveandclose) = "yes" Then Excel.Workbooks(fileName).Close SaveChanges:=True
    End If
    End If

    Alapból a fájlokat nem látható ablakban nyitom meg, ezért még kellett a makró végére ez is, hogy megjelenjenek:

    If manualcheck = True Then
    lastrow = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
    counter = 2

    Do While counter <= lastrow

    If Not ws.Range("A" & counter).EntireRow.Hidden Then
    sPath = ws.Range("D" & counter)
    fileName = Right(sPath, Len(sPath) - InStrRev(sPath, "\"))
    manual = ws.Range("P" & counter)
    If CStr(manual) = "yes" Then Windows(fileName).Visible = True
    End If

    counter = counter + 1
    Loop

    ma.Activate
    Range("A1").Select

    MsgBox "Update and print the sheets manually"
    Else: MsgBox "Done!"

    End If

    Ránézésre jól csináltam mindent?

Új hozzászólás Aktív témák