Tuesday, November 5, 2013

VBA code to store value in a cell

VBA code to store user defined value in user defined cell(s).

Sub Test()
Dim myrange As Range
Dim mycell As Integer
Dim i As Range
On Error Resume Next

Set myrange = Application.InputBox(prompt:="enter a range of cell", Title:="Specify range", Type:=8)

For Each i In myrange

mycell = Application.InputBox(prompt:="Enter a number", Type:=1)

i = mycell

Next i
End Sub

No comments:

Post a Comment