Setting the focus

  • Thread starter Thread starter Orf Bartrop
  • Start date Start date
O

Orf Bartrop

I have created a spreadsheet requiring data to be entered in a set
order. By that I mean the first entry will be in the first blank cell in
column "B".
On pressing "Enter" I want the focus to move to C, D, E, F then M, N and O.
Two questions:
How do I get Excel to open with the focus in the first blank cell in
column B?
How do I set the movement of the focus on pressing "Enter"?
The cells between column F and M are calculated cells and do not need to
be selected. The cell in column A has the date automatically calculated
when data is added to cell B, C or D.
Please make your reply simple for me to follow as I am rather ignorant
as far as VB is concerned.

Orf
 
This takes a few steps to get to work exactly the way you want it to.

First, the coding part. Enter this into the Workbook code section using the
Visual Basic Editor

Option Explicit

Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Range("B65536").End(xlUp).Offset(1, 0).Select
End Sub

To get into the VB Editor, start by pressing [Alt]+[F11] then look at the
Project window and double-click the entry in the 'tree' that says "This
Workbook". If you don't see the Project window (left side of the screen,
upper left 1/3rd of the screen) choose View | Project from the menu bar.

This presumes that the first empty cell in column B will be at the end of a
list of entries in that column, and that there are not empty cells within
filled in cells in that column. If the sheet name you need to go to is
something other than "Sheet1", change that, of course.

To get your cursor to move from Left to Right across the sheet instead of
top to bottom, go to
Toos | Options and choose the [Edit] tab. Find the entry that says "Move
Selection After Enter" and check the box next to it and change the direction
from "Down" to "Right"

Now that doesn't stop the cursor from stopping in cells in between the
columns you want it to stop at. Here's how to "fix" that:

Choose the columns where you do want the user to enter information into and
then use Format | Cells and uncheck the box next to "Locked" on the
[Protection] tab. You will want to do this for all columns that you want the
user to be able to enter information into, as B, C, D, E, F, M, N and O. Go
back to your worksheet and choose
Tools | Protection | Protect Sheet
and clear the checkbox next to the entry that says Select Locked Cells.
Whether or not you assign a password as being required to unlock the sheet is
up to you. Until you test it and make sure it works, I'd just leave it blank
that way all you have to do is choose Tools | Protection | Unprotect Sheet to
work in it some more.

This should set you up to work the way you want it all to work.
 
Thank you, I will try this later today.
This takes a few steps to get to work exactly the way you want it to.

First, the coding part. Enter this into the Workbook code section using the
Visual Basic Editor

Option Explicit

Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Range("B65536").End(xlUp).Offset(1, 0).Select
End Sub

To get into the VB Editor, start by pressing [Alt]+[F11] then look at the
Project window and double-click the entry in the 'tree' that says "This
Workbook". If you don't see the Project window (left side of the screen,
upper left 1/3rd of the screen) choose View | Project from the menu bar.

This presumes that the first empty cell in column B will be at the end of a
list of entries in that column, and that there are not empty cells within
filled in cells in that column. If the sheet name you need to go to is
something other than "Sheet1", change that, of course.

To get your cursor to move from Left to Right across the sheet instead of
top to bottom, go to
Toos | Options and choose the [Edit] tab. Find the entry that says "Move
Selection After Enter" and check the box next to it and change the direction
from "Down" to "Right"

Now that doesn't stop the cursor from stopping in cells in between the
columns you want it to stop at. Here's how to "fix" that:

Choose the columns where you do want the user to enter information into and
then use Format | Cells and uncheck the box next to "Locked" on the
[Protection] tab. You will want to do this for all columns that you want the
user to be able to enter information into, as B, C, D, E, F, M, N and O. Go
back to your worksheet and choose
Tools | Protection | Protect Sheet
and clear the checkbox next to the entry that says Select Locked Cells.
Whether or not you assign a password as being required to unlock the sheet is
up to you. Until you test it and make sure it works, I'd just leave it blank
that way all you have to do is choose Tools | Protection | Unprotect Sheet to
work in it some more.

This should set you up to work the way you want it all to work.

:


I have created a spreadsheet requiring data to be entered in a set
order. By that I mean the first entry will be in the first blank cell in
column "B".
On pressing "Enter" I want the focus to move to C, D, E, F then M, N and O.
Two questions:
How do I get Excel to open with the focus in the first blank cell in
column B?
How do I set the movement of the focus on pressing "Enter"?
The cells between column F and M are calculated cells and do not need to
be selected. The cell in column A has the date automatically calculated
when data is added to cell B, C or D.
Please make your reply simple for me to follow as I am rather ignorant
as far as VB is concerned.

Orf
 
I believe all of that should take you to the point you've asked for. If you
have any difficulty with inserting the code or finding your way around in the
VB Editor, hopefully the information I've provided on this page will help:
http://www.jlathamsite.com/Teach/WorkbookCode.htm


Orf Bartrop said:
Thank you, I will try this later today.
This takes a few steps to get to work exactly the way you want it to.

First, the coding part. Enter this into the Workbook code section using the
Visual Basic Editor

Option Explicit

Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Range("B65536").End(xlUp).Offset(1, 0).Select
End Sub

To get into the VB Editor, start by pressing [Alt]+[F11] then look at the
Project window and double-click the entry in the 'tree' that says "This
Workbook". If you don't see the Project window (left side of the screen,
upper left 1/3rd of the screen) choose View | Project from the menu bar.

This presumes that the first empty cell in column B will be at the end of a
list of entries in that column, and that there are not empty cells within
filled in cells in that column. If the sheet name you need to go to is
something other than "Sheet1", change that, of course.

To get your cursor to move from Left to Right across the sheet instead of
top to bottom, go to
Toos | Options and choose the [Edit] tab. Find the entry that says "Move
Selection After Enter" and check the box next to it and change the direction
from "Down" to "Right"

Now that doesn't stop the cursor from stopping in cells in between the
columns you want it to stop at. Here's how to "fix" that:

Choose the columns where you do want the user to enter information into and
then use Format | Cells and uncheck the box next to "Locked" on the
[Protection] tab. You will want to do this for all columns that you want the
user to be able to enter information into, as B, C, D, E, F, M, N and O. Go
back to your worksheet and choose
Tools | Protection | Protect Sheet
and clear the checkbox next to the entry that says Select Locked Cells.
Whether or not you assign a password as being required to unlock the sheet is
up to you. Until you test it and make sure it works, I'd just leave it blank
that way all you have to do is choose Tools | Protection | Unprotect Sheet to
work in it some more.

This should set you up to work the way you want it all to work.

:


I have created a spreadsheet requiring data to be entered in a set
order. By that I mean the first entry will be in the first blank cell in
column "B".
On pressing "Enter" I want the focus to move to C, D, E, F then M, N and O.
Two questions:
How do I get Excel to open with the focus in the first blank cell in
column B?
How do I set the movement of the focus on pressing "Enter"?
The cells between column F and M are calculated cells and do not need to
be selected. The cell in column A has the date automatically calculated
when data is added to cell B, C or D.
Please make your reply simple for me to follow as I am rather ignorant
as far as VB is concerned.

Orf
 
Back
Top