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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Colo

MrExcel MVP,
Joined
Mar 20, 2002
Messages
1,659
Office Version
  1. 2016
  2. 2003 or older
Platform
  1. Windows
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.
 

Forum statistics

Threads
1,182,191
Messages
5,934,180
Members
436,935
Latest member
Fergjosh97

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
Top