MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Inputing Data


Posted by Alisa on January 29, 2002 8:48 AM

HELP! How do I create a macro which enters a value into a cell that the user inputs and then goes to the next cell on the right and so on.

For example...
What is the date? 1/29/02(User inputs date)
What is the amount due? 50.00
What is the amount paid? 50.00

I know these seems basic but I just don't know where to start. thanks


Posted by Jim on January 30, 2002 5:16 AM

Not perfect but this is how I'd do it:

Sub enter_data()

newdata:
ActiveCell = InputBox("Date?", vbOKCancel)
ActiveCell.Offset(0, 1).Select
ActiveCell = InputBox("Amount due?", vbOKCancel)
ActiveCell.Offset(0, 1).Select
ActiveCell = InputBox("Amount paid?", vbOKCancel)
ActiveCell.Offset(1, -2).Select
ans = MsgBox("Next dataset. Continue?", vbOKCancel)
If ans = vbOK Then
GoTo newdata
Else: Exit Sub
End If

End Sub


Give it a go.

Hope it helps

Posted by Alisa on January 30, 2002 1:10 PM

Thanks so much!