Posted to microsoft.public.excel.programming
|
|
macro equivalent to arrow keys
Thanks Ron. It worked, with a small modification.
"Ron de Bruin" wrote:
Hi
Try this example that copy it to C22
SubTest()
Dim FindString As String
Dim Rng As Range
FindString = Application.WorksheetFunction.Max(Range("C13:C20") )
Set Rng = Range("C13:C20").Find(What:=FindString, _
After:=Range("C20"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Rng.Resize(1, 2).Copy Range("C22")
Else
MsgBox "Nothing found"
End If
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl
"Jim Robinson" wrote in message ...
What are the macro equivalent commands corresponding to the arrow keys (up
down left right) and to the "end" key?
Right now if I do the "record keystrokes" command for end up to take me up
to the last row with data, the recorded macro takes me to a particular cell.
I want it to simply do the equivalent of end up no matter where end up might
take me.
Here is what I am actually trying to do.
Dim rng As Range, tvalue
tvalue = WorksheetFunction.Max(Range("C13:C20"))
Set rng = Cells.Find(tvalue)
I find the max value (tvalue) in a range, then I set rng to be the cell
where that value is located. Now I want to go to that cell and copy tvalue
and the data in the cell to the right of tvalue to another location.
I have no problem determining tvalue or determining the cell location of
tvalue. Beyond that, I am stumped.
|