#1   Report Post  
Posted to microsoft.public.excel.misc
D. D. is offline
external usenet poster
 
Posts: 53
Default Code to find code

Hi,
What's the code to find a code?
I would like to be able to click a button and it will take me to a
particular code in the vba viewer
Thanks

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Code to find code

Try something like the following.


Sub AAA()
Dim FindWhat As String
Dim StartLine As Long
Dim EndLine As Long
Dim StartCol As Long
Dim EndCol As Long
Dim Found As Boolean

With Application.VBE
If .ActiveCodePane Is Nothing Then
MsgBox "No Code Pane Active"
Exit Sub
End If
With .ActiveCodePane
FindWhat = "findme"
StartLine = 0
EndLine = .CodeModule.CountOfLines
StartCol = 0
EndCol = 0
Found = .CodeModule.Find( _
target:=FindWhat, _
StartLine:=StartLine, _
startcolumn:=StartCol, _
EndLine:=EndLine, _
endcolumn:=EndCol, _
wholeword:=False, _
MatchCase:=False, _
PatternSearch:=False)
If Found = True Then
.SetSelection StartLine, StartCol, EndLine, EndCol
Else
MsgBox "Not Found"
End If
End With
End With
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"D." wrote in message
oups.com...
Hi,
What's the code to find a code?
I would like to be able to click a button and it will take me to a
particular code in the vba viewer
Thanks


  #3   Report Post  
Posted to microsoft.public.excel.misc
D. D. is offline
external usenet poster
 
Posts: 53
Default Code to find code

Thanks Chip,
That seems like quite a long code,
Maybe I should have worded it differently

What's the code to go to a code, ,
I have seen sample workbooks, with a button, ie:Click here to view
code

Of course now that I want to use that type of code I can't find any of
those workbooks

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
Find last row code Mike Milmoe Excel Discussion (Misc queries) 2 June 11th 07 08:48 PM
How do I find a code in Excel Terranoman Excel Worksheet Functions 4 May 18th 07 02:29 PM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Why code for find() is not working jesmin Excel Discussion (Misc queries) 1 December 28th 05 08:43 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM


All times are GMT +1. The time now is 02:03 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"