MACRO:Find-Arrow

32CARDS

Board Regular
Joined
Jan 1, 2005
Messages
123
Example Code:
Sub Macro5()
'
' Macro5 Macro
Cells.Find(What:="here", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate

'arrow key right !! NOT Cell D7

Range("D7").Select

End Sub
====================================================
The Issue:

The "Find *here*" part of the script is fine, but the "Range ("D7).Select"
has to be a "arrow key" direction from wherever the cell with "find" is located, but not specificaly cell D7.

====================================================
The question:

What is the macro code for "arrow key" left,right,up and down" ?
It then has to copy the contents of the cell, right of "find"


Answer/s:


===========================================================

Thanks in advance
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi 32CARDS,
The OFFSET property makes it possible.
Just use
Code:
Selection.offset(0,-1).Select
instead of
Code:
Range("D7").Select
.

Left : Offset(0,-1)
Right: Offset(0,1)
Up: Offset(-1,0)
Down: Offset(1,0)

Note: 0 can be omitted, so you can just write Offset(1) when you'd like to specify Down. Offset(,1) stands for Right.
 
Upvote 0

Forum statistics

Threads
1,214,790
Messages
6,121,608
Members
449,038
Latest member
apwr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top