1004 error: unable to get the StDev_S property of the WorksheetFunction Class










1















Here is the spreadsheet data that I'm working with.



https://docs.google.com/spreadsheets/d/1aEgf29yigbwbemJdToJrlws9iJFMamUztM0PbdrsOQw/edit?usp=sharing



It highlights the line
.Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
and I'm not sure why. I printed the range and all the values are what I was looking for. I've done similar worksheetfunctions with ranges in the past and haven't had a problem.



Here is the Code that I'm Using



Sub run_stats()

Dim i As Long
Dim nrows As Long
Dim rng As Range
Dim cell As Range


For i = 3 To 50
Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
For Each cell In rng
Debug.Print cell.Value
Next cell
With Worksheets("Statistics")
.Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
.Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
.Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
.Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
.Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
.Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
.Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
.Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
End With
Next i

End Sub


EDIT: Corrected code



Sub run_stats()

Application.ScreenUpdating = False
Application.Calculation = xlManual

Dim i As Long
Dim nrows As Long
Dim rng As Range
Dim cell As Range

Worksheet("Statistics").Range("C4:AX35").ClearContents

For i = 3 To 50
Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
For Each cell In rng
If Application.WorksheetFunction.IsError(cell) Then
cell.Value = ""
End If
Next cell
If Application.WorksheetFunction.CountA(rng) >= 2 Then
With Worksheets("Statistics")
.Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
.Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
.Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
.Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
.Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
.Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
.Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
.Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
End With
End If
Next i

Application.ScreenUpdating = True
Application.Calculation = xlAutomatic

End Sub









share|improve this question




























    1















    Here is the spreadsheet data that I'm working with.



    https://docs.google.com/spreadsheets/d/1aEgf29yigbwbemJdToJrlws9iJFMamUztM0PbdrsOQw/edit?usp=sharing



    It highlights the line
    .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
    and I'm not sure why. I printed the range and all the values are what I was looking for. I've done similar worksheetfunctions with ranges in the past and haven't had a problem.



    Here is the Code that I'm Using



    Sub run_stats()

    Dim i As Long
    Dim nrows As Long
    Dim rng As Range
    Dim cell As Range


    For i = 3 To 50
    Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
    For Each cell In rng
    Debug.Print cell.Value
    Next cell
    With Worksheets("Statistics")
    .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
    .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
    .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
    .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
    .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
    .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
    .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
    .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
    End With
    Next i

    End Sub


    EDIT: Corrected code



    Sub run_stats()

    Application.ScreenUpdating = False
    Application.Calculation = xlManual

    Dim i As Long
    Dim nrows As Long
    Dim rng As Range
    Dim cell As Range

    Worksheet("Statistics").Range("C4:AX35").ClearContents

    For i = 3 To 50
    Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
    For Each cell In rng
    If Application.WorksheetFunction.IsError(cell) Then
    cell.Value = ""
    End If
    Next cell
    If Application.WorksheetFunction.CountA(rng) >= 2 Then
    With Worksheets("Statistics")
    .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
    .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
    .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
    .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
    .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
    .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
    .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
    .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
    End With
    End If
    Next i

    Application.ScreenUpdating = True
    Application.Calculation = xlAutomatic

    End Sub









    share|improve this question


























      1












      1








      1








      Here is the spreadsheet data that I'm working with.



      https://docs.google.com/spreadsheets/d/1aEgf29yigbwbemJdToJrlws9iJFMamUztM0PbdrsOQw/edit?usp=sharing



      It highlights the line
      .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
      and I'm not sure why. I printed the range and all the values are what I was looking for. I've done similar worksheetfunctions with ranges in the past and haven't had a problem.



      Here is the Code that I'm Using



      Sub run_stats()

      Dim i As Long
      Dim nrows As Long
      Dim rng As Range
      Dim cell As Range


      For i = 3 To 50
      Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
      For Each cell In rng
      Debug.Print cell.Value
      Next cell
      With Worksheets("Statistics")
      .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
      .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
      .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
      .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
      .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
      .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
      .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
      .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
      End With
      Next i

      End Sub


      EDIT: Corrected code



      Sub run_stats()

      Application.ScreenUpdating = False
      Application.Calculation = xlManual

      Dim i As Long
      Dim nrows As Long
      Dim rng As Range
      Dim cell As Range

      Worksheet("Statistics").Range("C4:AX35").ClearContents

      For i = 3 To 50
      Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
      For Each cell In rng
      If Application.WorksheetFunction.IsError(cell) Then
      cell.Value = ""
      End If
      Next cell
      If Application.WorksheetFunction.CountA(rng) >= 2 Then
      With Worksheets("Statistics")
      .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
      .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
      .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
      .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
      .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
      .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
      .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
      .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
      End With
      End If
      Next i

      Application.ScreenUpdating = True
      Application.Calculation = xlAutomatic

      End Sub









      share|improve this question
















      Here is the spreadsheet data that I'm working with.



      https://docs.google.com/spreadsheets/d/1aEgf29yigbwbemJdToJrlws9iJFMamUztM0PbdrsOQw/edit?usp=sharing



      It highlights the line
      .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
      and I'm not sure why. I printed the range and all the values are what I was looking for. I've done similar worksheetfunctions with ranges in the past and haven't had a problem.



      Here is the Code that I'm Using



      Sub run_stats()

      Dim i As Long
      Dim nrows As Long
      Dim rng As Range
      Dim cell As Range


      For i = 3 To 50
      Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
      For Each cell In rng
      Debug.Print cell.Value
      Next cell
      With Worksheets("Statistics")
      .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
      .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
      .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
      .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
      .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
      .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
      .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
      .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
      End With
      Next i

      End Sub


      EDIT: Corrected code



      Sub run_stats()

      Application.ScreenUpdating = False
      Application.Calculation = xlManual

      Dim i As Long
      Dim nrows As Long
      Dim rng As Range
      Dim cell As Range

      Worksheet("Statistics").Range("C4:AX35").ClearContents

      For i = 3 To 50
      Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
      For Each cell In rng
      If Application.WorksheetFunction.IsError(cell) Then
      cell.Value = ""
      End If
      Next cell
      If Application.WorksheetFunction.CountA(rng) >= 2 Then
      With Worksheets("Statistics")
      .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
      .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
      .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
      .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
      .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
      .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
      .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
      .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
      End With
      End If
      Next i

      Application.ScreenUpdating = True
      Application.Calculation = xlAutomatic

      End Sub






      excel vba excel-vba






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 21:55







      Keizzerweiss

















      asked Nov 15 '18 at 16:10









      KeizzerweissKeizzerweiss

      569




      569






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Check your data in Sheet1 for error values such us #N/A. You can try this workaround that changes error values to empty string:



          Option Explicit

          Sub run_stats()

          Dim i As Long
          Dim nrows As Long
          Dim rng As Range
          Dim cell As Range


          For i = 3 To 50
          Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
          For Each cell In rng
          Debug.Print cell.Value
          'check if value is error -> change to empty cell if it is
          If Application.WorksheetFunction.IsError(cell) Then
          cell.Value = ""
          End If
          Next cell
          With Worksheets("Statistics")
          .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
          .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
          .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
          .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
          .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
          .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
          .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
          .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
          End With
          Next i

          End Sub





          share|improve this answer























          • works great. I had to add in an if statement along with your answer to make sure that there were at least two non error items in each rng. will edit with fixed code

            – Keizzerweiss
            Nov 15 '18 at 21:44











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323529%2f1004-error-unable-to-get-the-stdev-s-property-of-the-worksheetfunction-class%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Check your data in Sheet1 for error values such us #N/A. You can try this workaround that changes error values to empty string:



          Option Explicit

          Sub run_stats()

          Dim i As Long
          Dim nrows As Long
          Dim rng As Range
          Dim cell As Range


          For i = 3 To 50
          Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
          For Each cell In rng
          Debug.Print cell.Value
          'check if value is error -> change to empty cell if it is
          If Application.WorksheetFunction.IsError(cell) Then
          cell.Value = ""
          End If
          Next cell
          With Worksheets("Statistics")
          .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
          .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
          .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
          .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
          .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
          .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
          .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
          .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
          End With
          Next i

          End Sub





          share|improve this answer























          • works great. I had to add in an if statement along with your answer to make sure that there were at least two non error items in each rng. will edit with fixed code

            – Keizzerweiss
            Nov 15 '18 at 21:44
















          1














          Check your data in Sheet1 for error values such us #N/A. You can try this workaround that changes error values to empty string:



          Option Explicit

          Sub run_stats()

          Dim i As Long
          Dim nrows As Long
          Dim rng As Range
          Dim cell As Range


          For i = 3 To 50
          Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
          For Each cell In rng
          Debug.Print cell.Value
          'check if value is error -> change to empty cell if it is
          If Application.WorksheetFunction.IsError(cell) Then
          cell.Value = ""
          End If
          Next cell
          With Worksheets("Statistics")
          .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
          .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
          .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
          .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
          .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
          .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
          .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
          .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
          End With
          Next i

          End Sub





          share|improve this answer























          • works great. I had to add in an if statement along with your answer to make sure that there were at least two non error items in each rng. will edit with fixed code

            – Keizzerweiss
            Nov 15 '18 at 21:44














          1












          1








          1







          Check your data in Sheet1 for error values such us #N/A. You can try this workaround that changes error values to empty string:



          Option Explicit

          Sub run_stats()

          Dim i As Long
          Dim nrows As Long
          Dim rng As Range
          Dim cell As Range


          For i = 3 To 50
          Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
          For Each cell In rng
          Debug.Print cell.Value
          'check if value is error -> change to empty cell if it is
          If Application.WorksheetFunction.IsError(cell) Then
          cell.Value = ""
          End If
          Next cell
          With Worksheets("Statistics")
          .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
          .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
          .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
          .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
          .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
          .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
          .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
          .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
          End With
          Next i

          End Sub





          share|improve this answer













          Check your data in Sheet1 for error values such us #N/A. You can try this workaround that changes error values to empty string:



          Option Explicit

          Sub run_stats()

          Dim i As Long
          Dim nrows As Long
          Dim rng As Range
          Dim cell As Range


          For i = 3 To 50
          Set rng = Worksheets("Sheet1").Range(Worksheets("Sheet1").Cells(11, i), Worksheets("Sheet1").Cells(11, i).End(xlDown))
          For Each cell In rng
          Debug.Print cell.Value
          'check if value is error -> change to empty cell if it is
          If Application.WorksheetFunction.IsError(cell) Then
          cell.Value = ""
          End If
          Next cell
          With Worksheets("Statistics")
          .Cells(4, i).Value = Application.WorksheetFunction.StDev_S(rng)
          .Cells(5, i).Value = Application.WorksheetFunction.Average(rng) + (2 * Application.WorksheetFunction.StDev_S(rng))
          .Cells(6, i).Value = Application.WorksheetFunction.Average(rng) + Application.WorksheetFunction.StDev_S(rng)
          .Cells(7, i).Value = Application.WorksheetFunction.Average(rng)
          .Cells(8, i).Value = Application.WorksheetFunction.Average(rng) - Application.WorksheetFunction.StDev_S(rng)
          .Cells(9, i).Value = Application.WorksheetFunction.Average(rng) - (2 * Application.WorksheetFunction.StDev_S(rng))
          .Cells(10, i).Value = Application.WorksheetFunction.Min(rng)
          .Cells(11, i).Value = Application.WorksheetFunction.Max(rng)
          End With
          Next i

          End Sub






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 15 '18 at 17:16









          Pawel CzyzPawel Czyz

          7432819




          7432819












          • works great. I had to add in an if statement along with your answer to make sure that there were at least two non error items in each rng. will edit with fixed code

            – Keizzerweiss
            Nov 15 '18 at 21:44


















          • works great. I had to add in an if statement along with your answer to make sure that there were at least two non error items in each rng. will edit with fixed code

            – Keizzerweiss
            Nov 15 '18 at 21:44

















          works great. I had to add in an if statement along with your answer to make sure that there were at least two non error items in each rng. will edit with fixed code

          – Keizzerweiss
          Nov 15 '18 at 21:44






          works great. I had to add in an if statement along with your answer to make sure that there were at least two non error items in each rng. will edit with fixed code

          – Keizzerweiss
          Nov 15 '18 at 21:44




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323529%2f1004-error-unable-to-get-the-stdev-s-property-of-the-worksheetfunction-class%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Barbados

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3