PDA

View Full Version : inputbox help wanted



lior03
10-02-2007, 11:06 AM
hello
i have three columns of numeric values each separated by an empty column.i want to place a formula in a cell i choose through an inputbox .then i want to copy the formula to all cells of the area i chose earlier.

Application.ScreenUpdating = False
Dim Cell As Range
Dim usa As Range
Dim ussr As Range
Set usa = Application.InputBox("select a range", , , , , , 8)
Set ussr = Application.InputBox("first cell is:", , , , , , 8)
selection.Font.Bold = True
For Each Cell In usa
ussr.Select
ActiveCell.FormulaR1C1 = "=(RC[1]/RC[-1])-1"
ussr.NUMBERFORMAT = "0.00%"
If IsEmpty(Cell) Then
ussr.Copy
Cell.PasteSpecial paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Cell.NUMBERFORMAT = "0.00%"
End If
Next
Application.ScreenUpdating = True

Bob Phillips
10-02-2007, 11:29 AM
Application.ScreenUpdating = False
Dim usa As Range
Dim ussr As Range
Set usa = Application.InputBox("select a range", , , , , , 8)
Set ussr = Application.InputBox("first cell is:", , , , , , 8)
With ussr
.FormulaR1C1 = "=(RC[1]/RC[-1])-1"
.NumberFormat = "0.00%"
End With
With usa
.FormulaR1C1 = "=(RC[1]/RC[-1])-1"
.NumberFormat = "0.00%"
End With

Application.ScreenUpdating = True