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

I am trying to create a routine that will update a table by a given user
input. What I have seems to execute but no change are made. Any ideas about
what I am doing wrong would be appreciated.

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

Sub GlobalChange()

Amt = InputBox("By What % (As Decimal)")
lastrow = Worksheets("planned sales").Cells(Rows.Count, "d").End(xlUp).Row
Set rng = Range("d8:o" & lastrow)
For Each cell In rng
cell.Value = Round(cell.Value * (1 + Amt), 2)
Next


End Sub