Consulting

Results 1 to 2 of 2

Thread: inputbox help wanted

  1. #1
    VBAX Mentor
    Joined
    Jun 2005
    Posts
    374
    Location

    inputbox help wanted

    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.
    [VBA]
    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

    [/VBA]
    moshe

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •