Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Alusta()
- ' Tämä ajetaan 1. välilehdelle ja vain kerran
- For i = 12 To 34
- t = Cells(i, 1).Top
- h = Cells(i, 1).Height
- ActiveSheet.CheckBoxes.Add(6, t, 20, h).Select
- Selection.Name = "ChkBox" & i
- Selection.Text = ""
- Selection.OnAction = "Piilota"
- Next i
- End Sub
- Sub KaikkiNäkyviin()
- ' Nappiin kytketty makro
- Rows("12:34").Hidden = False
- Application.EnableEvents = False
- For i = 12 To 34
- ActiveSheet.CheckBoxes("ChkBox" & i).Visible = 1
- Rows(i).Hidden = fase
- Next i
- Application.EnableEvents = True
- End Sub
- Sub Piilota()
- For i = 12 To 34
- If ActiveSheet.CheckBoxes("ChkBox" & i).Value = 1 Then
- ActiveSheet.CheckBoxes("ChkBox" & i).Value = 0
- ActiveSheet.CheckBoxes("ChkBox" & i).Visible = 0
- Rows(i).Hidden = True
- Call Tarkista("Sheet2", i)
- ' Call Tarkista("Sheet3", i) ' jne.
- Exit Sub
- End If
- Next
- End Sub
- Sub Tarkista(Sivu, r)
- For rr = 1 To Sheets(Sivu).Range("A1").SpecialCells(xlCellTypeLastCell).Row
- Löytyi = True
- For c = 2 To Cells(r, Sheets(Sivu).Columns.Count).End(xlToLeft).Column
- If Cells(r, c) <> Sheets(Sivu).Cells(rr, c) Then
- Löytyi = False
- Exit For
- End If
- Next c
- If Löytyi Then
- Sheets(Sivu).Rows(rr).Hidden = True
- Exit Sub ' Tämä rivi pois, jos sivuilla voi olla useampia samanlaisia rivejä
- End If
- Next rr
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement