PDA

View Full Version : cells value



oleg_v
02-25-2010, 01:41 AM
Hi

i need some help:

i need a macro that when i run it from excel then input box will pop up with "cells value " question and when i enter the number manually the number will appear in sheet2 cell "A8"

thanks

Oleg

domfootwear
02-25-2010, 02:18 AM
Hi

i need some help:

i need a macro that when i run it from excel then input box will pop up with "cells value " question and when i enter the number manually the number will appear in sheet2 cell "A8"

thanks

Oleg

Try this code:


Sub InputNumber()
Dim nNumber As Long
nNumber = InputBox("Enter number")
Sheet2.Cells(8, 1) = nNumber
End Sub

jazznaura
02-25-2010, 02:22 AM
use something like the following.
check VBA help.

Sub InputValue()
Dim MyValue As String
MyValue = Application.InputBox _
(Prompt:="Please enter a value")
If MyValue <> vbNullString Then
Sheets("sheet2").Range("A8").Value = MyValue
Else
MsgBox ("No value entered")
End If
End Sub