Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help Im crap at VBA


Hello all,
I have altered a simple macro to find a record within a sheet why oh
why does it not work when a new work sheet is created and I copy the
macro across and also how do I make this search all sheets within a
work book all help gratefully received.

Sub cmdFind_Click()
Dim nResult As Integer
Dim cFind As String
Dim cBookMark As String
'
Cells.Find(range("a1"), LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate


End Sub


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Help Im crap at VBA

What happens when you run it? Doesn't work is pretty nebulous.

What version of excel are you running?

If it's xl97, try changing the .takefocusonclick property to false (fixed in
xl2k).

Then check the name of the button on the new sheet. Is it still called
cmdFind_click?

But even better, if you don't want to reinvent that wheel, you could use this
very useful utility:

Jan Karel Pieterse's FlexFind at:
http://www.bmsltd.co.uk/MVP



liamothelegend wrote:

Hello all,
I have altered a simple macro to find a record within a sheet why oh
why does it not work when a new work sheet is created and I copy the
macro across and also how do I make this search all sheets within a
work book all help gratefully received.

Sub cmdFind_Click()
Dim nResult As Integer
Dim cFind As String
Dim cBookMark As String
'
Cells.Find(range("a1"), LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate

End Sub

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


--

Dave Peterson

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



All times are GMT +1. The time now is 01:05 AM.

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

About Us

"It's about Microsoft Excel"