Prøv
I et Modul:
Sub Makro2()
Range("H4:H24").Select
ActiveWorkbook.Worksheets(ActiveSheet.Name).Sort.SortFields.Clear
ActiveWorkbook.Worksheets(ActiveSheet.Name).Sort.SortFields.Add Key:=Range("H4:H24"), _
SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:="01.01.12", _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets(ActiveSheet.Name).Sort
.SetRange Range("A4:K24")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
På Arkene
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("K3:K10000"), Target) Is Nothing Then
For Each c In Range("K3:K10000").Cells
If c.Value = "x" Then
c.EntireRow.Hidden = True
End If
Next c
End If
If Not Intersect(Range("I3:I10000"), Target) Is Nothing Then
For Each c In Range("K3:K10000").Cells
If c.Value = "x" Then
c.EntireRow.Hidden = False
End If
Next c
ActiveWorkbook.Worksheets(ActiveSheet.Name).Sort.SortFields.Clear
ActiveWorkbook.Worksheets(ActiveSheet.Name).Sort.SortFields.Add Key:=Range("I3:I10000"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets(ActiveSheet.Name).Sort
.SetRange Range("A3:K10000")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
For Each c In Range("K3:K10000").Cells
If c.Value = "x" Then
c.EntireRow.Hidden = True
End If
Next c
End If
End Sub