View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
James Ravenswood James Ravenswood is offline
external usenet poster
 
Posts: 143
Default Insert same value across many cells

On Aug 7, 4:09*pm, Pete wrote:
I have 2 values that are taken from an Inputbox that I need to copy
across a range of cells what would be the best and most efficient way
to do this? I need the values to be inserted into column A & B from
the next Blank Cell in Column A

Thanks

Peter


Perhaps something like:


Sub AB()
Dim A As Range, B As Range
n = Cells(Rows.Count, "A").End(xlUp).Row + 1
Set A = Range("A" & n)
n = Cells(Rows.Count, "B").End(xlUp).Row + 1
Set B = Range("B" & n)
vA = Application.InputBox(Prompt:="Give a value for column A",
Type:=1)
vB = Application.InputBox(Prompt:="Give a value for column B",
Type:=1)
A.Value = vA
B.Value = vB
End Sub