LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Problems, doing a find in another sheet.

Try this out.

Private Sub CommandButton1_Click()
Dim nv As String

nv = Range("a2").Value
Sheets("data").Select

Cells.Find(What:=nv, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False) _
.Activate
End Sub


-----Original Message-----
I have a commandbutton in a sheet, with the following code

Private Sub CommandButton1_Click()
Dim nv As String

nv = Range("a2").Value
Sheets("data").Select

Cells.Find(What:=nv, After:=ActiveCell,

LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows,

SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate


End Sub

When I use the code I get a runtime error 1004: The

method Activeate for the
class Range did not succeed (its in Danish so im not

sure of the
translation), and it is the Cells.Find that fails.

If I do the find in the same sheet as the button, it

works allright. How can
I get it to perform a seach in another sheet than

contains the command
button.

Jan


.

 
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
Problems with the Find & Select yaro137 Excel Discussion (Misc queries) 1 January 22nd 09 01:00 PM
Problems with the Right & Find functions beginner here Excel Worksheet Functions 14 July 16th 07 11:20 PM
Problems with find/replace function BobS9895 Excel Worksheet Functions 1 September 8th 06 09:42 PM
Problems with Find & Replace Gazzr Excel Discussion (Misc queries) 3 April 7th 06 05:41 AM
Problems with Find in VBA/Excel Roy Kirkland Excel Worksheet Functions 0 November 22nd 04 02:58 AM


All times are GMT +1. The time now is 12:52 PM.

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"