Simple Macro

G

Guest

I am a long time lotus user and am now required to use Excell. I wrote my
first macro--a very simple one, but I want it to continue until I tell it to
stop. It runs through and doesn't complete a loop.

Here is the Macro:
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = "x"
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(1, 0).Select
Selection.End(xlToLeft).Select
Do While ActiveCell.Value = (blank)
Loop
End Sub
 
T

Trevor Shuttleworth

Not entirely sure what your data might look like or what you want to achieve
but try this:

Do While ActiveCell.Value = ""
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = "x"
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = InputBox("EnterValue")
ActiveCell.Offset(1, 0).Select
Selection.End(xlToLeft).Select
Loop

Regards

Trevor
 
G

Guest

Trevor,
It's just a macro to do data entry, which is just the first part of my
worksheet. I wasn't a great macro writer before, but am now really stumped.
Thank you for your help, this worked.

MA
 
D

Don Guillett

Sub fillformsimple()
For i = 2 To Cells(Rows.Count, "g").End(xlUp).Row
Cells(i, "h") = InputBox("enter value")
Next i
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

Top