Selecting the one with the bigest amount
See modifications in your code. Dont declare maxaddress as object.
---------------------------------------
Dim r As Range
Dim x, y, max As Integer
Dim maxaddress
For x = 2 To 4
For y = 2 To 6
If Cells(x, y) max Then
max = Cells(x, y).Value
maxaddress = Cells(x, y).Address
End If
Next
Next
ActiveSheet.Range(maxaddress).Select
Selection.Font.Bold = True
----------------------------------------------------
"Ruslan" wrote:
Could you tell me what is wrong with my code?
Sorry I'm just a beginner.
Dim r As Range
Dim x, y, max As Integer
Dim maxaddress As Object
For x = 2 To 4
For y = 2 To 6
If Cells(x, y) max Then
max = Cells(x, y).Value
maxaddress = Cells(x, y).Address
End If
Next
Next
maxaddress.Select
|