ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   name validation (https://www.excelbanter.com/excel-programming/397607-name-validation.html)

Luis A. Vázquez

name validation
 
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?


jhyatt

name validation
 
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



All times are GMT +1. The time now is 05:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com