Excel macro which prompts for input and moves to a cell - repeated

K

KenZimbo

To: All pundits in Microsoft Excel
From: Ken Spencer in Zimbabwe (Email: (e-mail address removed))
Subject: Kindly requests help on Microsoft Excel.
Date: 8 September 2008

In Lotus 123, (which I have long since stopped using) I used a simple Macro
to:
1. Go to a cell
2. Get a prompt to enter a value, e.g. “Enter ‘Month of Year’â€
3. Enter the value and press Enter to move to another cell.
4. Get another prompt to enter another value, e.g. “Enter ‘Sales Volume for
the Month’â€
5. Enter the value and press Enter to move to another cell
6. Etc Etc.

Can anybody out there please tell me how I can do this in Excel by recording
keystrokes in a Macro? Please note I haven’t the first clue about Microsoft
Visual Basic.

Thanks in advance

Kindest regards

Ken Spencer
 
M

Mike H

Hi,

You could do this

Do
response = Int(Val(InputBox("Enter Month of Year")))
If IsNumeric(response) And response >= 1 And response <= 12 Then
Range("A1").Value = response
Else
response = ""
MsgBox ("You must enter a number between 1 & 12")
End If
Loop Until response <> ""


This gets a numner between 1 & 12 and puts it in a1. repeat these steps
ammending the validation as necessary.

Mike
 
D

Don Guillett

Many ways. Here is one idea. You could also unlock the cells to goto>put a
comment in each>protect the sheet.

Sub enterdatainselectedcells()
q1 = InputBox("enterdata1")
If q1 <> "" Then Application.Goto Range("b2")
q2 = InputBox("enterdata1")
If q2 <> "" Then Application.Goto Range("b12")
'etc
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