lychee
Civil/Environmental
- Aug 26, 2003
- 4
Is there a way to write a macro to prompt user to key in...say the project title and its client's name and automatically puts the answer to cell A1 and B1 respectively? If the cell A1 and B1 is already filled, the macro automatically writes the answer to the following cell (i.e A2 and B2). I'd written something like this but i would like the macro to loop back to the 1st question insstead of continuing to the 2nd, any help?
Sub Macro1()
Message1 = "Enter project title"
Title1 = "Project info"
Message2 = "Enter client's name"
Title2 = "Client info"
answer1 = InputBox(Message1, Title1, ""
answer2 = InputBox(Message2, Title2, ""
If answer1 = Empty Then
MsgBox Prompt:="You must enter a value."
answer1 = InputBox(Message1, Title1, ""
Else
Range("A1"
= answer1
End If
If answer2 = Empty Then
MsgBox Prompt:="You must enter a value."
Else
Range("B1"
= answer2
End If
End Sub
Sub Macro1()
Message1 = "Enter project title"
Title1 = "Project info"
Message2 = "Enter client's name"
Title2 = "Client info"
answer1 = InputBox(Message1, Title1, ""
answer2 = InputBox(Message2, Title2, ""
If answer1 = Empty Then
MsgBox Prompt:="You must enter a value."
answer1 = InputBox(Message1, Title1, ""
Else
Range("A1"
End If
If answer2 = Empty Then
MsgBox Prompt:="You must enter a value."
Else
Range("B1"
End If
End Sub