Prikazi cijelu temu 13.01.2019 15:18
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Lokacija:Tuzla


Predmet:Re: Kako da obrisem redove sa markiranim celijama
PreuzmiIzvorni kôd (Visual Basic):
  1. Sub sbDelete_Rows_Based_On_Cell_Color()
  2. Dim Rng As Range
  3. Dim ws As Worksheet
  4. Dim ZadnjaKolona As Long
  5. Dim ZadnjiRed As Long
  6. Dim Celija As Range
  7. Dim I As Integer, N As Integer
  8.  
  9. '***********************************************
  10. 'avkina stara procedura samo malo prepravio
  11. '**********************************************
  12. Set ws = Application.ActiveSheet
  13. Set Celija = ws.Cells.Find(What:="*", After:=ws.Cells(1, 1), LookIn:=xlFormulas, _
  14.                                     LookAt:=xlPart, SearchOrder:=xlByColumns, _
  15.                                     SearchDirection:=xlPrevious, MatchCase:=False)
  16.  ZadnjaKolona = Celija.Column
  17.  Set Celija = ws.Cells.Find(What:="*", After:=ws.Cells(1, 1), LookIn:=xlFormulas, _
  18.                                     LookAt:=xlPart, SearchOrder:=xlByRows, _
  19.                                     SearchDirection:=xlPrevious, MatchCase:=False)
  20.  ZadnjiRed = Celija.Row
  21. Dim a
  22. For I = 1 To ZadnjiRed
  23.   For N = 1 To ZadnjaKolona
  24.     If Cells(I, N).Interior.ColorIndex <> -4142 Then 'boja
  25.        Rows(I).Delete
  26.     End If
  27.   Next N
  28. Next I
  29. End Sub

Podrška samo putem foruma, jer samo tako i ostali imaju koristi od toga.