Thread: Code Help
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ronbo Ronbo is offline
external usenet poster
 
Posts: 162
Default Code Help

Thanks a lot for all of the help. After including all of the code OssieMac
provided rather than just changing the cell to cel... it (seems) to work
perfectly. Thanks.

Regrads
Ronbo

"CurlyDave" wrote:

On Feb 17, 6:45 pm, Ronbo wrote:
I have the following code that I need to take a range (f16..f51) and
increase/decrease it by a user input value i.e. f16=e16*(1+user input)

Option Explicit
Dim rng As Range
Dim lastrow As Long
Dim cell As Range
Dim Amt As Double

Sub Test()

Amt = InputBox("By What % (As Decimal)")

Set rng = Range("f16:f51")
For Each cell In rng
cell.Value = (cell.FormulaR1C1 = "=RC[-1]*(1+Amt),")

I get "FALSE" in each cell. What am I doing wrong?

Ronbo


Give this a try

Sub Test()
Dim amt As Variant
Dim rng As Range, cell As Range
amt = InputBox("By What % (As Decimal)")

Set rng = Range("F16:F51")
For Each cell In rng.Cells
cell = cell.Offset(0, -1) * 1+amt
Next
End Sub