ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Mouvement macro (https://www.excelbanter.com/excel-programming/365852-mouvement-macro.html)

Fil

Mouvement macro
 
Hi, I'm developping an excel workbook where users enter some data, than
activate a macro that treat that data in some way, pretty standard stuff.
The problem is, the users have to enter a lot of data, so I need a macro
that they can activate, that will make it so that when they press enter, it
automatically goes to the next cell. It would pretty much move one cell left
every time they press enter until they get to the end of the line where it
will go to the first cell of the next line.
Is that possible? If so, how?

kassie

Mouvement macro
 
And once it reaches the first cell of the next row, how does it move from
there?

"Fil" wrote:

Hi, I'm developping an excel workbook where users enter some data, than
activate a macro that treat that data in some way, pretty standard stuff.
The problem is, the users have to enter a lot of data, so I need a macro
that they can activate, that will make it so that when they press enter, it
automatically goes to the next cell. It would pretty much move one cell left
every time they press enter until they get to the end of the line where it
will go to the first cell of the next line.
Is that possible? If so, how?


Fil

Mouvement macro
 
It starts over again.
So for exemple, lets say the valid columns are the ones between 1 and 5 and
the current cell selected is B3. He presses enter once, it goes to B4. He
presses enter again, B5, again, C1, C2, C3, C4, C5, D1, D2... etc

"kassie" wrote:

And once it reaches the first cell of the next row, how does it move from
there?



Fil

Mouvement macro
 
Wow... I don't know what I was thinking, I got the letters and numbers
inverted. What I ment in my previous post's exemple was :
"So for exemple, lets say the valid columns are the ones between A and E and
the current cell selected is C3. He presses enter once, it goes to D3. He
presses enter again, E3, again, A4, B4, C4, D4, E4, A5, B5... etc"
Sorry for the confusion.

Duncan[_5_]

Mouvement macro
 
I dont know if im reading this right but....

Can you just unlock the cells you want entry into (columns a to e would
do) and protect the worksheet stating select unlocked cells only then:
Application.MoveAfterReturnDirection = xlToRight
(or do this manually, tools, options, edit - enter direction setting)

This should surely sort it?

Let us know because im not sure if ive read it right.

Duncan


Fil wrote:

Wow... I don't know what I was thinking, I got the letters and numbers
inverted. What I ment in my previous post's exemple was :
"So for exemple, lets say the valid columns are the ones between A and E and
the current cell selected is C3. He presses enter once, it goes to D3. He
presses enter again, E3, again, A4, B4, C4, D4, E4, A5, B5... etc"
Sorry for the confusion.



Duncan[_5_]

Mouvement macro
 
Behind a button this would look like:

Range("A:E").Locked = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
Application.MoveAfterReturnDirection = xlToRight

But bear in mind:

You will need to unprotect via code and wont be able to by the
worksheet, so another button that had "activesheet.unprotect" would be
advised before you tried this!

Duncan


Duncan wrote:

I dont know if im reading this right but....

Can you just unlock the cells you want entry into (columns a to e would
do) and protect the worksheet stating select unlocked cells only then:
Application.MoveAfterReturnDirection = xlToRight
(or do this manually, tools, options, edit - enter direction setting)

This should surely sort it?

Let us know because im not sure if ive read it right.

Duncan


Fil wrote:

Wow... I don't know what I was thinking, I got the letters and numbers
inverted. What I ment in my previous post's exemple was :
"So for exemple, lets say the valid columns are the ones between A and E and
the current cell selected is C3. He presses enter once, it goes to D3. He
presses enter again, E3, again, A4, B4, C4, D4, E4, A5, B5... etc"
Sorry for the confusion.



Fil

Mouvement macro
 
Well... I didn't think of it that way, but it works.
Problem is, this was ment to speed up the entry, not prevent them from
changing other stuff, I'll have to check with the users to see if locking the
worksheet during entry is a problem.
Thank you for your help.

"Duncan" wrote:

I dont know if im reading this right but....

Can you just unlock the cells you want entry into (columns a to e would
do) and protect the worksheet stating select unlocked cells only then:
Application.MoveAfterReturnDirection = xlToRight
(or do this manually, tools, options, edit - enter direction setting)

This should surely sort it?

Let us know because im not sure if ive read it right.

Duncan



Fil

Mouvement macro
 
I talked to fast, it doesn't work correctly. For some reason, when I get to
the end of a certain line (multiple tests gave me a bunch of different
results), it goes back to the first line.
So it goes A1, B1, C1, D1, E1, A2, B2, C2, D2, E2, A1...
I am able to select A3 for exemple and it will go : A3, B3, C3, D3, E3, A1,
B1, C1, D1, E1, A2, B2, C2, D2, E2, A1...


All times are GMT +1. The time now is 07:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com