Private Sub cmdInput_Click()
range("d7") = InputBox("Enter a value")
inputval = InputBox("Enter a value")
range("d8") = range("d7") * inputval
End Sub
Private Sub cmdMax_Click()
range("D1") = Application.Max(range("a1:a10"))
range("D2") = Application.SumIfs(range("a1:a10"),
range("a1:a10"), ">5")
' now use lastrow
lastrow = range("b65000").End(xlUp).Row
range("D3") = Application.Min(range("b1:b" & lastrow))
End Sub
Option Explicit
Dim lastrow, lastcell
Dim firstrow
Private Sub cmdSum1_Click()
' put sum of values from a1 to end in b1
lastrow = range("a65000").End(xlUp).Row
range("b1") = Application.Sum(range("a1:a" & lastrow))
End Sub
Private Sub cmdSum2_Click()
'Prompt for the last row to use
lastrow = InputBox("Enter last row")
'Use the lastrow input as the last row to sum up in column A
range("b2") = Application.Sum(range("a1:a" & lastrow))
End Sub
Private Sub cmdSum3_Click()
'prompt for first and last rows
firstrow = InputBox("enter first row")
lastrow = InputBox("enter last row")
'use the first and last row to sum up a range in column A
range("b3") = Application.Sum(range("a" & firstrow & ":a" &
lastrow))
End Sub