Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Andrzej
 
Posts: n/a
Default I have question.. I have problem with Cells.find





I have two file (p1.xls , p2,.xls). When I work in file (p2.xls) i need to
find something
in second file(p1.xls). Then write value from Cecha in the ActiveCell of
p2.xls, provided
that Cecha is found

I have button and code:
but this code does not work how I want !! because search in file p2....
(it work on inversely)
What I should modify ?? that it search in p1.xls ???


Sub CommandButton3_Click() '------in file p2.xls
Dim szukana As Range
Dim Cecha as String

Cecha = InputBox("Enter the name", "Enter value")
If Cecha = "" Then Exit Sub
Workbooks.Open Filename:= _
"C:\Documents and Settings\.....\p1.xls"
Set szukana = Cells.Find(What:=Cecha, After:=ActiveCell,
LookIn:=xlFormulas,
LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False)
If szukana Is Nothing Then
MsgBox "Sorry, but " & Cecha & "was not found" '--- in p1.xls ?
ActiveWorkbook.Close
' ---p1.xls?
Exit Sub
Else
Cells.Find(What:=Cecha, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=
_
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:= _

False, SearchFormat:=False).Activate
MsgBox "Value " & Cecha & "was found" '--- in p1.xls ?
ActiveWorkbook.Close

ActiveCell.Value = Cecha '---in to
p2.xls ?
End If

End Sub



I will be grateful for every answer



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Display Problem Bill Martin -- (Remove NOSPAM from address) Excel Discussion (Misc queries) 0 April 19th 05 05:25 PM
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
autofilter problem emre Excel Worksheet Functions 0 March 29th 05 10:19 PM
Freeze Pane problem in shared workbooks JM Excel Discussion (Misc queries) 1 February 1st 05 12:04 AM
Row Autofit problem Excel 2003 Matthias Klaey Excel Discussion (Misc queries) 0 January 19th 05 05:33 PM


All times are GMT +1. The time now is 03:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"