Macro to move from cell to cell after entering data

Steveoma

New Member
Joined
Feb 26, 2002
Messages
2
I have created a form used to confirm orders. I would like to make a macro to move from cell to cell after data has been entered. For example, the macro would go to cell A1 where data such as name would be entered, them move to cell A5 where address would be entered then to cell a6 where city would be entered and so on.

Thanks.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
This is a copy of a portion of a macro that I use to enter data into consecutive columns. Note: Active cell.offset (row, column) tells the cursor where you want to go. For example . Active cell.offset (1,1) tells the macro to go down one row and over one column.


sub enterdata ()

inputdata:
ActiveCell = InputBox("Date?", vbOKCancel)
ActiveCell.Offset(0, 1).Select
ActiveCell = InputBox("Invoice Number?", vbOKCancel)
ActiveCell.Offset(0, 1).Select
ActiveCell = InputBox("Amount Paid?", vbOKCancel)
ActiveCell.Offset(1, -1).Select
Selection.End(xlToLeft).Select
ans = MsgBox("Do you Want to Key Another?", vbYesNo)
If ans = vbYes Then
GoTo inputdata
Else: Exit Sub
End If



Good Luck!
 
Upvote 0
Hi Steve,

One of the easiest ways to do this is to simply unlock all the cells that data may be entered into. You can do this by selecting them (Ctrl-click on each cell in succession), then go to Format -> Cells -> Protection tab, uncheck the Locked checkbox.

Then protect the whole worksheet (Tools -> Protection -> Protect Sheet). Just make sure to write down the password if you assign one.

Once you have done this, control will always skip to the next unlocked cell when you tab or enter data.
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,181
Members
448,871
Latest member
hengshankouniuniu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top