Sub practice()
Dim sht As Worksheet
Set sht = Worksheets("R401a")
Dim one, two As Range ' two will be treated the same as one, just haven't coded it yet.
Set one = sht.Range("one")
Set two = sht.Range("two")
Dim arr()
arr = sht.Range("one") ' one is a excel table I named
Dim i As Integer
For i = LBound(one) To UBound(one)
var1 = arr(i,1)
var2 = arr(i,2)
var3 = arr(i,3)
var4 = arr(i,4)
x= var1*var2*var3*var4 ' the actual equation is more complicated, using specific variables.
Next i
End Sub
[TABLE="width: 500"]
<tbody>[TR]
[TD]var1[/TD]
[TD]var2[/TD]
[TD]var3[/TD]
[TD]var4[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]3[/TD]
[TD]5[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]8[/TD]
[TD]2[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
I was wondering if there was a way to make this more automated, as in, automatically making the var1, var2.... from the header row, then setting them equal to the column values. So that the same macro would work on, say
[TABLE="width: 500"]
<tbody>[TR]
[TD]Change_In_temperature[/TD]
[TD]mass[/TD]
[TD]Enthalpy[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]8[/TD]
[TD]4180[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]5[/TD]
[TD]4172[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]6[/TD]
[TD]4195[/TD]
[/TR]
</tbody>[/TABLE]
Dim sht As Worksheet
Set sht = Worksheets("R401a")
Dim one, two As Range ' two will be treated the same as one, just haven't coded it yet.
Set one = sht.Range("one")
Set two = sht.Range("two")
Dim arr()
arr = sht.Range("one") ' one is a excel table I named
Dim i As Integer
For i = LBound(one) To UBound(one)
var1 = arr(i,1)
var2 = arr(i,2)
var3 = arr(i,3)
var4 = arr(i,4)
x= var1*var2*var3*var4 ' the actual equation is more complicated, using specific variables.
Next i
End Sub
[TABLE="width: 500"]
<tbody>[TR]
[TD]var1[/TD]
[TD]var2[/TD]
[TD]var3[/TD]
[TD]var4[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]3[/TD]
[TD]5[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]8[/TD]
[TD]2[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
I was wondering if there was a way to make this more automated, as in, automatically making the var1, var2.... from the header row, then setting them equal to the column values. So that the same macro would work on, say
[TABLE="width: 500"]
<tbody>[TR]
[TD]Change_In_temperature[/TD]
[TD]mass[/TD]
[TD]Enthalpy[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]8[/TD]
[TD]4180[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]5[/TD]
[TD]4172[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]6[/TD]
[TD]4195[/TD]
[/TR]
</tbody>[/TABLE]