I was unable to get this going:
All attempts ended with Message box:
The letter 'F' could not be found. (just 1 example)
??????????
in
message news
[email protected]...
Hi,
This is not pressing a key, but close, and it works:
In this example you enter a letter in "B1" it will jump to the
location of the letter in Col "A"
Code is from Otto Moehrbach.
Put in worksheet module
Code:
--------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
If Target.Address(0, 0) = "B1" Then Call ShiftList(Range("B1").Value)
End Sub
--------------------
Put in general module
Code:
--------------------
Sub ShiftList(sLetter As String)
Dim MyRng As Range
Dim SearchFor As String
Set MyRng = Range("A2", Range("A" & Rows.Count).End(xlUp))
SearchFor = sLetter & "*"
On Error Resume Next
MyRng.Find(What:=SearchFor, After:=MyRng(MyRng.Count), _
LookAt:=xlWhole).Activate
If Err <> 0 Then
MsgBox "The letter '" & sLetter & "' cannot be found."
Err.Clear
Exit Sub
End If
On Error GoTo 0
With ActiveWindow
.ScrollRow = ActiveCell.Row
.ScrollColumn = 1
End With
End Sub
+-------------------------------------------------------------------+
|Filename: Macro - Find - Word in Column by Entering One Letter in Cell.zip|
|Download:
http://www.excelforum.com/attachment.php?postid=3914 |
+-------------------------------------------------------------------+