Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Pasmatos
 
Posts: n/a
Default 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.
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default 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.



  #3   Report Post  
Gary''s Student
 
Posts: n/a
Default 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.

  #4   Report Post  
Duke Carey
 
Posts: n/a
Default 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.

  #5   Report Post  
Pasmatos
 
Posts: n/a
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I automatically move vertical cells horizontally? Trice New Users to Excel 0 October 7th 05 04:57 PM
Display first, second, etc Nonblank Cells in a Range Jeremy N. Excel Worksheet Functions 12 September 25th 05 01:47 PM
Use functions when cells are merged Amanda Excel Worksheet Functions 3 September 12th 05 06:08 PM
Counting only active cells Sac73 Excel Discussion (Misc queries) 16 April 4th 05 05:49 AM
To safety merge cells without data destroyed, and smart unmerge! Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:17 AM


All times are GMT +1. The time now is 06:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"