Good evening,
I'm struggling with my code. Main problem is not calculating formula automatically. Formula is inserted by VBA (Left function) I've tried multiple solutions, but nothing works:
- automatically calculated formulas are switched on
- I've tried ActiveCell.NumberFormat = "General" - doesnt work
- I've tried Application.Volatile - doesnt work
- Recording text to columns and assign cells to "general" (works, but not when Im putting code into my script)
Could you please help me where lies the problem?
Sub QualityCheck()
'załóż filtry, wyszukaj nagłowka "vendor" i posortuj
    Rows("1:1").Select
    Range("F1").Activate
    Selection.AutoFilter
    Selection.Find(What:="Vendor", After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate
    Worksheets(1).AutoFilter.Sort.SortFields.Clear
    Worksheets(1).AutoFilter.Sort.SortFields.Add Key:=Range _
        ("K1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With Worksheets(1).AutoFilter.Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
'statystyki
    'znajdz wszystkie te same numery vendora i ostatni aktywny ROW
    i = 2
    r = 2
    koniec = Range("K" & Rows.Count).End(xlUp).Row
    Columns("N:N").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Do Until Range("K" & r) < koniec
            Do Until Range("K" & i) <> Range("K" & i + 1)
                    Range("N" & i).Select
                    Formula = "=left(M" & i & ";1)"
                    Range("N" & i).Formula = Formula  'OFFSET DODAC ALBO COS
                    ActiveCell.NumberFormat = "General"
                i = i + 1 'i to bedzie nasz ostatni row
            Loop
        r = r + 1
    Loop
    Selection.TextToColumns Destination:=Range("N1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 1), TrailingMinusNumbers:=True
End Sub
 
    