ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Move 2 cells to right (https://www.excelbanter.com/excel-discussion-misc-queries/54524-move-2-cells-right.html)

Pasmatos

Move 2 cells to right
 
hi,
Please help.
In excel vba, what is the command to move the cursor.
Example: The cursor was in one cell and i want move it 2 cells to the left.

Thanks in advance.

Bob Phillips

Move 2 cells to right
 
Activecell.Offset(0,2).Select

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Pasmatos" wrote in message
...
hi,
Please help.
In excel vba, what is the command to move the cursor.
Example: The cursor was in one cell and i want move it 2 cells to the

left.

Thanks in advance.




Gary''s Student

Move 2 cells to right
 
Sub Macro1()
Dim i As Long
Dim j As Long
j = Selection.Column
i = Selection.Row
Cells(i, j + 2).Select
End Sub

to move to an arbitrary place use
Cells(I+9,J+13).Select for example

--
Gary's Student


"Pasmatos" wrote:

hi,
Please help.
In excel vba, what is the command to move the cursor.
Example: The cursor was in one cell and i want move it 2 cells to the left.

Thanks in advance.


Duke Carey

Move 2 cells to right
 
You rarely need to select a cell or range of cells in VBA. Code is cleaner
and works FAR faster if you do not select cells.

To answer you question, though

activecell.offset(0,-2).select

Now, if you are selecting it because you want to copy it, or clear it, etc,
do this instead

activecell.offset(0,-2).copy
activecell.offset(0,-2).clear
activecell.offset(0,-2).pastespecial xlPasteAll


"Pasmatos" wrote:

hi,
Please help.
In excel vba, what is the command to move the cursor.
Example: The cursor was in one cell and i want move it 2 cells to the left.

Thanks in advance.


Pasmatos

Move 2 cells to right
 
Hi!
Thanks to all for your help about.

Regards.
Paulo



"Pasmatos" wrote:

hi,
Please help.
In excel vba, what is the command to move the cursor.
Example: The cursor was in one cell and i want move it 2 cells to the left.

Thanks in advance.



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

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