Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2008

Tip: Looking for answers? Try searching our database.

Visual Basic Code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Glenn Robertson - 02 Apr 2008 16:26 GMT
Hi,
I am trying to write some visual basic code behind a macro and I want it to
do the following.

1) Select the whole of coloum C
2) Activate the find box as in (CTRL + F)

Alternativly some code so that I could enter something in cell A1 then click
the macro and it would search coloumn C for the value that is in cell A1.

Many thanks, Glenn
Ron Coderre - 02 Apr 2008 16:41 GMT
If you search VBA Help for: FindMethod
you'll see some examples.

Meanwhile....Here's something to get you started:

Sub UseFind()
Dim vResult
Dim sht As Worksheet
Set sht = ActiveSheet
With sht
  Set vResult = .Range("C:C") _
     .Find( _
        What:=.Range("A1").Value, _
        LookAt:=xlPart)
  If Not vResult Is Nothing Then
     vResult.Select
  Else
     MsgBox "No match"
  End If
End With
End Sub

Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

> Hi,
> I am trying to write some visual basic code behind a macro and I want it
[quoted text clipped - 9 lines]
>
> Many thanks, Glenn
Dave Peterson - 02 Apr 2008 17:32 GMT
I'd use Ron's technique, but you could just select column C and show the
Edit|Find dialog, too:

Option Explicit
Sub testme01()
   With ActiveSheet
       .Range("C1").EntireColumn.Select
       Application.Dialogs(xlDialogFormulaFind).Show _
           arg1:=.Range("a1").Value
   End With
End Sub

It won't find the value--it just shows the dialog to the user.

> Hi,
> I am trying to write some visual basic code behind a macro and I want it to
[quoted text clipped - 7 lines]
>
> Many thanks, Glenn

Signature

Dave Peterson


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.