totalnatal
New Member
- Joined
- Jun 9, 2010
- Messages
- 33
Hello,
I would have created several variables within my code which are calculated solely within the code and would need to select the highest value out of these variables.
Basically need to select the max out of the variables from u to ad.
Thank you
I would have created several variables within my code which are calculated solely within the code and would need to select the highest value out of these variables.
Code:
Dim a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, sa, t, u, v, w, x, y, z, aa, ab, ac, ad As Long
s = 0
Do
For n = 1 To Range("f1").Value
a = Range("i3").Offset(s, 1).Value
b = Range("i3").Offset(s, 2).Value
c = Range("i3").Offset(s, 3).Value
d = Range("i3").Offset(s, 4).Value
e = Range("i3").Offset(s, 5).Value
f = Range("i3").Offset(s, 6).Value
g = Range("i3").Offset(s, 7).Value
h = Range("i3").Offset(s, 8).Value
i = Range("i3").Offset(s, 9).Value
j = Range("i3").Offset(s, 10).Value
k = Worksheet.Function.VLookup(Worksheet.Function.Edate(Range("i3").Offset(s, 0).Value, n * 12), Range("I:J"), 2)
l = Worksheet.Function.VLookup(Worksheet.Function.Edate(Range("i3").Offset(s, 0).Value, n * 12), Range("I:K"), 3)
m = Worksheet.Function.VLookup(Worksheet.Function.Edate(Range("i3").Offset(s, 0).Value, n * 12), Range("I:L"), 4)
n = Worksheet.Function.VLookup(Worksheet.Function.Edate(Range("i3").Offset(s, 0).Value, n * 12), Range("I:M"), 5)
o = Worksheet.Function.VLookup(Worksheet.Function.Edate(Range("i3").Offset(s, 0).Value, n * 12), Range("I:N"), 6)
p = Worksheet.Function.VLookup(Worksheet.Function.Edate(Range("i3").Offset(s, 0).Value, n * 12), Range("I:O"), 7)
q = Worksheet.Function.VLookup(Worksheet.Function.Edate(Range("i3").Offset(s, 0).Value, n * 12), Range("I:P"), 8)
r = Worksheet.Function.VLookup(Worksheet.Function.Edate(Range("i3").Offset(s, 0).Value, n * 12), Range("I:Q"), 9)
sa = Worksheet.Function.VLookup(Worksheet.Function.Edate(Range("i3").Offset(s, 0).Value, n * 12), Range("I:R"), 10)
t = Worksheet.Function.VLookup(Worksheet.Function.Edate(Range("i3").Offset(s, 0).Value, n * 12), Range("I:S"), 11)
u = k / a
v = l / b
w = m / c
x = n / d
y = o / e
z = p / f
aa = q / g
ab = r / h
ac = sa / i
ad = t / j
Basically need to select the max out of the variables from u to ad.
Thank you