Advertisement
Guest User

Untitled

a guest
May 21st, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub otodik()
  2.  
  3. Dim mu As Double
  4. Dim szigma As Double
  5. Dim cella
  6.  
  7. mu = 0.05
  8. szigma = 0.2
  9.  
  10. Dim r As Range
  11. 1:
  12. Set r = Application.InputBox("Adjon meg egy négyzet alakú tartományt!", "Adjon meg egy négyzet alakú tartományt!", , , , , , 8)
  13. If r.Rows.Count <> r.Columns.Count Then
  14. GoTo 1
  15. End If
  16.  
  17. Application.Volatile
  18. For Each cella In r
  19.    
  20.     cella.Clear
  21.     cella.Value = mu + szigma * Application.WorksheetFunction.Norm_S_Inv(Rnd())
  22.     If Abs(cella.Value - mu) > szigma And Abs(cella.Value - mu) < 2 * szigma Then
  23.         cella.Interior.Color = vbRed
  24.     End If
  25. Next
  26.  
  27. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement