Guest User

Untitled

a guest
Apr 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. Private Sub CommandButton4_Click()
  2. Dim ws2 As Worksheet
  3. Dim y_out As Range
  4. Dim y_in As Range
  5. Dim x_in As Range
  6. Dim x_out As Range
  7. Dim length As Long
  8.  
  9. Set ws2 = Sheets("Sheet2")
  10. For i = 1 To datasets
  11.  
  12. length = ws2.Cells(ws2.Rows.Count, i + 4).End(xlUp).Row
  13.  
  14. Set y_out = ws2.Range(ws2.Cells(2, 2), ws2.Cells(length, 2))
  15. Set y_in = ws2.Range(ws2.Cells(2, 4), ws2.Cells(length, 4))
  16. Set x_in = ws2.Range(ws2.Cells(2, 3), ws2.Cells(length, 3))
  17. Set x_out = ws2.Range(ws2.Cells(2, 1), ws2.Cells(length, 1))
  18.  
  19. y_out.FormulaArray = "=loess(x_in;y_in;x_out;50)"
  20.  
  21. FormulaArray = _
  22. "=loess(RC[1]:R[490]C[1],RC[2]:R[490]C[2],RC[-1]:R[490]C[-1],50)"
  23.  
  24. End If
  25. Next i
  26.  
  27. End Sub
Add Comment
Please, Sign In to add comment