View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika Dick Kusleika is offline
external usenet poster
 
Posts: 179
Default I Tried it, still problem...

James

Reading your list and the code you recorded, here's what I put together.
There are still some parts of it that I don't understand, but maybe we can
start with this and see what needs to be modified.

Sub FindStuff()

Dim FndRng As Range

Set FndRng = Sheets("SCIT").Cells.Find( _
what:=ActiveSheet.Range("g9").Value, _
after:=Sheets("SCIT").Range("A1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

'If value is not found, FndRng will be Nothing
If Not FndRng Is Nothing Then
Sheets("FINDER").Range("g34").Value = FndRng.Value
Else
MsgBox "Value not found"
End If

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.


"James Burke" wrote in message
...
Thanks, but it found the wrong cell.

More Specifically, I want the macro to work as follows:
1. Go to a specific Cell
2. Copy to the clipboard all the text in that cell.
3. Paste what it copied into the Find box.
4. Go to a specific worksheet.
5. Go to the first cell (Control+home).
6. Paste what's on the clipboard into the Find Box and
Find.
7. Select the contents of that cell, and Copy it to the
clipboard.
8. Go to a specific worksheet and a specific cell, and
paste the contents of the clipboard in it.
8. Go to a specific worksheet and cell, and copy the
clipboard contents into it.

FOLLOWING IS THE CODE AS IT WAS RECORDED, WITH MY COMMENTS
IN IT TO POINT OUT WHAT'S WRONG WITH IT. (If you could
edit it to comply with my comments, that would be great.
Thanks.)
__________________________________________________ _________
___________
Sub Macro5()
'
Application.Goto Reference:="R9C7"
ActiveCell.Range("A1:T1").Select
ActiveCell.FormulaR1C1 = "1 2 b3 4 5 6 b7"
' [WRONG! COPY WHATEVER IS IN THERE AT THE TIME I RUN THE
MACRO]
Sheets("SCIT").Select
Application.Goto Reference:="R1C1"
Cells.Find(What:="1 2 b3 4 5 6 b7", After:=ActiveCell,
LookIn:=xlFormulas _
' [WRONG! FIND WHATEVER IS IN THERE AT THE TIME I RUN THE
MACRO]
, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Select
ActiveCell.FormulaR1C1 = "1 2 b3 4 5 6 b7 "
' [WRONG! ACTIVATE WHATEVER IS FOUND THERE AT THE TIME I
RUN THE MACRO]
Sheets("FINDER").Select
Application.Goto Reference:="R34C7"
ActiveCell.Select
ActiveCell.FormulaR1C1 = _
"Major-Mode 1 - Ionian (The Major Scale) 1 2 b3 4
5 6 b7 "
' [WRONG! THE TEXT SHOULD BE WHATEVER IS IN THERE AT THE
TIME I RUN THE MACRO]
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub