I am trying to copy a value for from one worksheet, do some math --> say I have three values that I want to subtract separately from cell i,j then find out which is the minimum...but I am having problems! And I am wondering if you guys can help me out.
Here's my code so far:
' Macro1 Macro
Dim i As Integer
Dim urban As Integer
Dim vegetation As Integer
Dim water As Integer
Dim min As Integer
Dim class As String
Dim urban_ave As Integer, vege_ave As Integer, wat_ave As Integer
Dim insheet As Worksheet, out As Worksheet, average As Worksheet
urban_ave = 127
vege_ave = 75
wat_ave = 48
For i = 266 To 267
For j = 1 To 3
water = (insheet.Cells(i, j).value - (wat_ave)
urban = (insheet.Cells(i, j).Value) - (urban_ave)
vegetation = (insheet.Cells(i, j).Value) - (vege_ave)
If water > urban Then
min = urban & out.Cells(i, j).Value = "U"
min = water & out.Cells(i, j).Value = "W"
If min > vegetation Then
min_final = vegetation
min_final = min & out.Cells(i, j).Value = "V"
Please, bare in mind that Kioskea is a mutual aid community, all answers on the forum are provided by volunteers who give their time free to help solve issues.
Therefore, it is specifically requested from Kioskea forum users correspond showing mutual respect. Therefore, when requesting assistance, the use of polite expressions,as for elsewhere in similar circumstances, is appreciated. (please, thank you, appreciate, grateful, etc.)