Hello everyone
I'm new in vba and try to figure out some stuff. I have a two columns in excel and i want to compare each number , for example A1 with B1. A2 with B2 etc..
If A1 is smaller than B1 return in cell C1 the B1. If not add the number in B1 as many times until it is bigger than A1.
[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl66, width: 64, align: right"]1[/TD]
[TD="class: xl65, width: 64, align: right"]8[/TD]
[TD="width: 64, align: right"]10[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]2[/TD]
[TD="class: xl65, align: right"]45[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]3[/TD]
[TD="class: xl65, align: right"]14[/TD]
[TD="align: right"]4[/TD]
[/TR]
</tbody>[/TABLE]
in line 1 the answer is 8<10 = 10, line 2 the answer is 25+25 = 50,line 3 the answer is 4+4+4+4 = 16.
So i started like this but i cant figure out how to proceed..
Dim qAnswer As Integer
qAnswer = 2
If Cells(qAnswer, 1).Value < Cells(qAnswer, 2).Value And Not IsEmpty(Cells(qAnswer, 1).Value) Then
Cells(qAnswer, 3) = Cells(qAnswer, 2).Value
Else
Any suggestions?
Thanks
I'm new in vba and try to figure out some stuff. I have a two columns in excel and i want to compare each number , for example A1 with B1. A2 with B2 etc..
If A1 is smaller than B1 return in cell C1 the B1. If not add the number in B1 as many times until it is bigger than A1.
[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl66, width: 64, align: right"]1[/TD]
[TD="class: xl65, width: 64, align: right"]8[/TD]
[TD="width: 64, align: right"]10[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]2[/TD]
[TD="class: xl65, align: right"]45[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD="class: xl66, align: right"]3[/TD]
[TD="class: xl65, align: right"]14[/TD]
[TD="align: right"]4[/TD]
[/TR]
</tbody>[/TABLE]
in line 1 the answer is 8<10 = 10, line 2 the answer is 25+25 = 50,line 3 the answer is 4+4+4+4 = 16.
So i started like this but i cant figure out how to proceed..
Dim qAnswer As Integer
qAnswer = 2
If Cells(qAnswer, 1).Value < Cells(qAnswer, 2).Value And Not IsEmpty(Cells(qAnswer, 1).Value) Then
Cells(qAnswer, 3) = Cells(qAnswer, 2).Value
Else
Any suggestions?
Thanks