name validation

  • Thread starter Thread starter =?iso-8859-1?q?Luis_A=2E_V=E1zquez?=
  • Start date Start date
?

=?iso-8859-1?q?Luis_A=2E_V=E1zquez?=

Hi Excel Gurus,

im looking to hava a small macro that checks if a cell that i
designate as a cell to enter your name is empty. and if so, to have a
input box ask for the name, and enter it into the cell.

i know nothing about programming but im doing an effort here, this is
the code i wrote: the thing is that when the inputbox comes up and i
write some thing and hit ok, it doesnt put it in B1.

Sub entername()
name = Range("B1")
B1 = name
If B1 = "" Then
B1 = InputBox("enter your name", "yourname here")
Else
MsgBox "name in place, continue(or something like that"
End If
End Sub

what is this programming newbie doing wrong?
 
try this

Sub entername()
If b1 = "" Then
b1 = InputBox("enter your name", "yourname here")
Else
MsgBox "name in place, continue(or something like that"
End If
Worksheets("Sheet1").Range("b1").Activate
ActiveCell = b1
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top