Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello all. could someone help me to do the following in a Macro. In cell A1, I have Number "1" I want to have : A2 = A1 + 1 A3 = A2 + 1 A4 = A3 + 1 ..... Axx = Axx-1 + 1 Thanks in advance Herve -- herve ------------------------------------------------------------------------ herve's Profile: http://www.excelforum.com/member.php...o&userid=27314 View this thread: http://www.excelforum.com/showthread...hreadid=482037 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() For i = 2 To n Cells(i,"A").Formula = "=A" & i-1 Next i but it is not clear how to determine what n is, or how to calculate it (the xx in yhour example). -- HTH RP (remove nothere from the email address if mailing direct) "herve" wrote in message ... Hello all. could someone help me to do the following in a Macro. In cell A1, I have Number "1" I want to have : A2 = A1 + 1 A3 = A2 + 1 A4 = A3 + 1 .... Axx = Axx-1 + 1 Thanks in advance Herve -- herve ------------------------------------------------------------------------ herve's Profile: http://www.excelforum.com/member.php...o&userid=27314 View this thread: http://www.excelforum.com/showthread...hreadid=482037 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
will this do?
Sub addone() For i = 1 To 4 Cells(i, 1) = i Next End Sub -- Don Guillett SalesAid Software "herve" wrote in message ... Hello all. could someone help me to do the following in a Macro. In cell A1, I have Number "1" I want to have : A2 = A1 + 1 A3 = A2 + 1 A4 = A3 + 1 .... Axx = Axx-1 + 1 Thanks in advance Herve -- herve ------------------------------------------------------------------------ herve's Profile: http://www.excelforum.com/member.php...o&userid=27314 View this thread: http://www.excelforum.com/showthread...hreadid=482037 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Herve, Add a VBA project module and past this code into it. EXAMPLE: A1 = 3 A2 Formula is "= IncrementCell()" A2 Result is 4 Code: -------------------- Function IncrementCell() As Long Dim X With ActiveCell If .Column = 1 Then Exit Function X = .Offset(0, -1).Value + 1 End With IncLeftCell = X End Function -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=482037 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Herve, This macro allows you to select the cell you want. You can also dran and fill your range with this formula. When the value in A1 changes, s do all the dependent cells. Copy this macro into a VBA project module To use it see the example. EXAMPLE A1 = 10 A2 = Increment(A1) A3 = Increment(A2) A4 = Increment(A3) RESULTS A1 = 10 A2 = 11 A3 = 12 A4 = 13 Macor Code Code ------------------- Function Increment(Cell As Excel.Range) As Long Application.Volatile Dim X On Error Resume Next X = Cell.Value + 1 Increment = X End Function ------------------- Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=48203 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks all, it works. Bye -- herve ------------------------------------------------------------------------ herve's Profile: http://www.excelforum.com/member.php...o&userid=27314 View this thread: http://www.excelforum.com/showthread...hreadid=482037 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|