View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Macro to select max value of range E

That is why I used the

C.Offset(0, 0),Select

You should have just copied and pasted the code.

" wrote:

On Oct 24, 5:00 pm, JLGWhiz wrote:
Also, the x = WorksheetFunction.Max(Range("E:E"))
Should be: x = Application.WorksheetFunction.Max(Range("E:E"))
To be the correct syntax. My fault.



" wrote:
On Oct 24, 2:48 pm, JLGWhiz wrote:
I think you would have to do something like this:


Private Sub CommandButton1_Click()
Dim c As Range
x = WorksheetFunction.Max(Range("E:E"))
Set c = Range("E:E").Find(x, LookIn:=xlValues)
If Not c Is Nothing Then
c.Offset(0, 0).Select
End If
End Sub


" wrote:
I am using the following script to select the maximum of the range E.
I get invalid qualifier error.
All I am trying to do is highlight/select the cell that has the max
value in range E. Please help me to accomplish this. Thanks


Private Sub CommandButton1_Click()
WorksheetFunction.Max(Range("E:E")).Select
End Sub- Hide quoted text -


- Show quoted text -


Hi.. I used your code and I did not see any selection in the sheet.


I used c.activate and I get an error "With block variable not set".
Any idea on this please?- Hide quoted text -


- Show quoted text -


Hi.. I am using the following code in the module but I still get an
error "Object variable or with block variable not set"

Dim c As Range
x = Application.WorksheetFunction.Max(Range("E:E"))
Set c = Range("E:E").Find(x, LookIn:=xlValues)
If Not c Is Nothing Then
c.Offset(0, 0).Select
Else
c.Select '''' error here

End If

Can you please help me out? Thanks