question about the Marco inputbox.

Joined
Mar 12, 2012
Messages
2
Reaction score
0
Hi,
I am new to Marco, I have some question about it. I have a list of data Account number (Column A), Pin number (Column D), Current Amount in the account (ColumnE).
I need to write a code is like the first inputbox asking the user account number, if they type in wrong account number, they need to retype it. After that they type in their password in the second inputbox untill its correct. Then the third inputbox asking the amount of money they want to put in their account. Then that amount of money + the money in the current account. I think i done the first two part of the question but I have no idea how to do the last part of the question. These are what I have so far.

Sub questionl()
Dim Account As String, AccountOK As Boolean, i As Long, AcNo As String
Dim pin As String, pinok As Boolean, pinNo As String
Do Until AccountOK
Account = InputBox("Enter Account Number")
For i = 1To 5
If Trim(LCase(Account)) = Trim(LCase(Sheets("AccountSheet").Range("A" & i).Value)) Then
AccountOK = True
ActiveCell.Value = AcNo
Exit For
End If
Next i
If Not AccountOK Then
MsgBox "Wrong Account Number", vbExclamation
End If
Loop
Do Until pinok
pin = InputBox("Enter your Pin Number")
For i = 1 To 5
If Trim(LCase(pin)) = Trim(LCase(Sheets("AccountSheet").Range("D" & i).Value)) Then
pinok = True
ActiveCell.Value = pinNo
Exit For
End If
Next i
If Not pinok Then
MsgBox "Wrong Pin number", vbExclamation
End If
Loop


Is there anyone can help me!!
Thank you very much
 

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

Top