samprg
asked on
Loop
Hello,
I need "loop" in Excel 2010 , please see in below. Thanks
Cell A - B - Result in C
2011 3 2011&2010&2009
I need "loop" in Excel 2010 , please see in below. Thanks
Cell A - B - Result in C
2011 3 2011&2010&2009
whoops! left out a line...
sub loopmacro()
dim x as integer
dim result as string
for x = 1 to range("B1").value
result = result & range("A1").value - (x - 1)
range("C1").value = result
next x
End sub
if you want this to happen to the whole column, let me know and I'll adjust the macro.
sub loopmacro()
dim x as integer
dim result as string
for x = 1 to range("B1").value
result = result & range("A1").value - (x - 1)
range("C1").value = result
next x
End sub
if you want this to happen to the whole column, let me know and I'll adjust the macro.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think this micro, I do not want to add macro please
so you don't want vba? You want a formula?
I'm sorry, I didn't understand that. Can you rephrase?
What's the highest possible value in row b?
ASKER
Yes, I want a formula
ASKER
etech0:
In Column B (3) is how many times for loop
In Column B (3) is how many times for loop
It will always be 3?
ASKER
Yes
in c3 type:
=a1&"&"&a1-1&"&"&a1-2
then copy down the column
=a1&"&"&a1-1&"&"&a1-2
then copy down the column
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
dim x as integer
dim result as string
for x = 1 to range("B1").value
result = result & range("A1").value - (x - 1)
next x
End sub