Advertisement
IvanRaka
Sep 5th, 2024
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. In 10. Area of Figures again missing formating in results:
  2.  
  3. Sub Area_Of_Figures()
  4.  
  5. Dim figureType As String
  6. figureType = Range("A1").Value
  7.  
  8. Select Case figureType
  9. Case "square"
  10. Dim side As Double
  11. side = Range("A2").Value
  12. With Range("A4")
  13. .Value = side * side
  14. .NumberFormat = "0.00"
  15. End With
  16. Case "rectangle"
  17. Dim width As Double, length As Double
  18. width = Range("A2").Value
  19. length = Range("A3").Value
  20. With Range("A4")
  21. .Value = width * length
  22. .NumberFormat = "0.00"
  23. End With
  24. Case "circle"
  25. Dim radius As Double
  26. radius = Range("A2").Value
  27. Range("A4").Value = WorksheetFunction.Pi() * radius * radius
  28. With Range("A4")
  29. .Value = WorksheetFunction.Pi() * radius * radius
  30. .NumberFormat = "0.00"
  31. End With
  32. End Select
  33.  
  34. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement