Thanks, but that's still not what I'm looking for, that would return the
average of the same range each time. I'm trying to return the average of
the range I have selected with my mouse at the time the userform is loaded.
Thanks, but that's still not exactly what I'm looking for. That would
always return the average of a specific range each time the userform is
loaded. What I need is to return the average of any range of cells that I
may have selected with my mouse at the time the userform is loaded.
With UserForm1
On Error Resume Next
.TextBox1.Text = Application.Average(Selection)
If Err Then _
.TextBox1.Text = "Invalid Selection" 'or perhaps zero
On Error GoTo 0
.Show
End With
With UserForm1
On Error Resume Next
.TextBox1.Text = Application.Average(Selection)
If Err Then _
.TextBox1.Text = "Invalid Selection" 'or perhaps zero
On Error GoTo 0
.Show
End With
With UserForm1
On Error Resume Next
.TextBox1.Text = Application.Average(Selection)
If Err Then _
.TextBox1.Text = "Invalid Selection" 'or perhaps zero
On Error GoTo 0
.Show
End With
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.