Hi,
trying to un a macro when a specific cell is changed with the code below. Even though cell H5 changes (linked to cell in other sheet with formula =RR!E12)
my macro doesn't run. Any suggestions on what I might have done wrong?
/A
trying to un a macro when a specific cell is changed with the code below. Even though cell H5 changes (linked to cell in other sheet with formula =RR!E12)
my macro doesn't run. Any suggestions on what I might have done wrong?
/A
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If Target.Address = "$H$5" Then
With Sheets("Redovisnposter")
.Range("A1:I20000").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
Range("Redovisnposter!Criteria"), CopyToRange:=Range("Redovisnposter!Extract" _
), Unique:=False
.Range("V2", .Cells(.Rows.Count, "V").End(xlUp)).Copy
End With
With Sheets("Analys per konsult")
.Range("B8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Set rData = .Range("B8", .Cells(.Rows.Count, "B").End(xlUp))
rData.RemoveDuplicates Columns:=1, Header:=xlNo
With .Sort
.SetRange rData
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
With .Range("B8", .Cells(.Rows.Count, "B").End(xlUp)).Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
End With
End If
Application.ScreenUpdating = True
End Sub