Commands for cursor moving right, left, up, down.

L

Leon Obers

Hello,

Sorry maybe for a basic question.
Trying to make a macro within MS Excel (automatic VSB scripting), I get
commands moving the cursor to a particular named cell instead of moving
the cursor to the "right", left etc.

Editing the macro, what are the commands just to let move the cursor to
- right
- left
- up
- down

Ages ago I made some simple macro's in Lotus 123 in such a way the macro
is repetaing itself by moving the cursor over the entire worksheet, to
convert data from horizontal placement, to vertical placement.

E.g. data of 7 coloms horizontal I want to change that the data is over
7 rows vertical. Next data of 7 coloms placed to the 7 next rows etc.

When data is converted to 7 rows each in only one row, I want to save
this as a text-file, so I get data in every single line. 7 lines
contains the data of one "record". Next 7 lines data of the next record.

What I want to do:

- cursor moving one cel down
- insert one row (6 times after each other)
- cursor moving one cel right
- cursor moving one cel up
- cut the entire data
- cursor moving one cel down
- cursor moving one cel left
- past the data in that particular cell
- cursor moving one cel right (2 times after each other)
- cursor moving one cel up
- cut the entire data
- cursor moving one cel down (2 times after each other)
- cursor moving one cel left (2 times after each other)
- cut the entire data
- cursor moving one cel right (3 times after each other)
- cursor moving one cel up (2 times after each other)
- cut the entire data
- cursor moving one cel down (3 times after each other)
- cursor moving one cel left (3 times after each other)
- cut the entire data

etc. till all data of 7 rows is set to 7 lines
- last line is cursor moving one cel down for the next "record"

after that, the macro has to repeat till the complete worksheet is finished.
 
P

Pete_UK

Put the macro recorder on while you perform your sequence - Tools |
Macro | Record new Macro. You will be prompted for a name, and you can
also specify where you want the macro to be located as well as setting
up a keyboard shortcut. You will probably want to record in RELATIVE
mode (click on the absolute/relative button to toggle).

Hope this helps.

Pete
 
L

Leon Obers

Pete_UK said:
Put the macro recorder on while you perform your sequence - Tools |
Macro | Record new Macro. You will be prompted for a name, and you can
also specify where you want the macro to be located as well as setting
up a keyboard shortcut.

As far, this is what I did before.
But with the result of more or less absolute cell places (a named cell
reference) within the macro instead of a "moving command" of the cursor
itself. (Just want a moving command from each place the curser is set).
You will probably want to record in RELATIVE
mode (click on the absolute/relative button to toggle).

Maybe that is the trick. But where to find absolute/relative button ?
If it is only to have an absolute cell named data, the macro doesn't
work for the entire spreadsheet, only for the first record.
That is the trouble of having commands that use a cell code (name)
instead of a "moving" command.

The way Excel acts:
Range("C10").Select

"C10" is a fixed place within the macro.

What I want is just a "moving" command to the right.
So:
When I set the curser at A1, the curser has to move to B1.
When I set the curser at C28, the curser has to move to D28.
 
P

Pete

When you record a macro you get a small square in the middle of the
display - there is an icon to stop recording and another to toggle
between absolute and relative. By default, this starts in absolute
mode, so you should click it once before making any keystrokes. It is
not the best design of icon, but if you look carefully you can just
about make out the difference between it being pressed and un-pressed.

Hope this helps.

Pete
 
L

Leon Obers

Pete said:
When you record a macro you get a small square in the middle of the
display - there is an icon to stop recording and another to toggle
between absolute and relative. By default, this starts in absolute
mode, so you should click it once before making any keystrokes.

Thanks, great, this works.

But now.
To avoid several hand mader starts of the macro I want to edit the macro
in a loop. I am not familiar with VSB but do have some experiance with
other dataase languages.
What is the exact way / commands to write down (edit) the macro?

Someting like this.


Start loop; if n < 401
n = n+1
{move, cut, move, past macro as found earlier above}
end loop
 

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