Your code is only looking at the current cell, not looping thru the
columns so this should do it.
Sub Macro1()
For Each c In Columns("A:AJ")
c.offset(-1,0).value=1
if not isempty(c.value) then c.value = (c.value
+1)*c.offset(-1,0).value
next
End Sub
However I'm unsure of your intent. You're setting the cell above the
current cell to 1, making your formula a very wordy way of adding 1 to
the active cell's current value, then changing what was the current
cell to "1" on the next pass; which will set every cell used in
columns A:AJ equal to 1. If this is your intent, then it would be
faster (not mention easier to read) to set the entire range at once,
like so:
Range("A1:AJ10").value=1
--
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our Facebook Group @ http://www.facebook.com/group.php?gid=287779555678
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
To post to this group, send email to [email protected]
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!
We reach over 6,800 subscribers worldwide and receive many nice notes about the
learning and support from the group.Let friends and co-workers know they can
subscribe to group at http://groups.google.com/group/excel-macros/subscribe
To unsubscribe, reply using "remove me" as the subject.