![]() |
autofill values
In a userform, i have a textbox asking user to fill in Sales Value
(e.g. 10,000) Then i have another text box asking to fill in Sales growth(e.g., 10). HOw do i write a code which will transfer the sales value(10,000)to cell A1, after which from A2 onwards, the value will be 11,000, which is 110% of A1, A3 will be 110% of A2 and so on for A4, A5........? |
autofill values
As with many of these, its a good idea to record a macro
& then examine the resultant code. Assuming a button named btnOK, then try something akin to this: Sub btnOK_Click() Range("A1") = txtStartValue Range("A2").FormulaR1C1 = _ "=R[-1]C+R[-1]C*" & txtIncrease / 100 Range("A2").AutoFill _ Destination:=Range("A2:A20"), _ Type:=xlFillDefault End Sub where txtStartValue=10000 txtIncrease=10 the results a A2 := 11000 A3 := 12100 A4 := 13310 .... A20 := 61159 Patrick Molloy Microsoft Excel MVP -----Original Message----- In a userform, i have a textbox asking user to fill in Sales Value (e.g. 10,000) Then i have another text box asking to fill in Sales growth(e.g., 10). HOw do i write a code which will transfer the sales value (10,000)to cell A1, after which from A2 onwards, the value will be 11,000, which is 110% of A1, A3 will be 110% of A2 and so on for A4, A5........? . |
All times are GMT +1. The time now is 01:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com