Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 12th, 2007, 06:32 AM
Registered User
Join Date: Oct 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help with a small piece of code (New to VB)

I need some help with code i am writing for work. My boss throws this project on me knowing i have no knowledge in Visual Basic or any code at all. LOL....so i have to basically teach myself but i am to the point where im lost.

I have this sheet of data, and what i need the macro/code to do is to scan each row of the first column and do so until it reaches/finds a value of 100. When and if it finds the value of 100, i need a message box to pop up stating what row the value is in. This is phase 1 of a 3 phase project, and i know i can do this manually by counting, but it has to be inputted into a machine that does the technical work the code will generate.

I know this is probably a very simple thing, but i have the Excel 2007 VBA programmers reference, but this whole code thing isnt my thing. But my boss just will not listen.....so i am here asking for any help i can get.

Thanks in advance!!
Old October 12th, 2007, 06:38 AM
Friend of Wrox
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts

Here you have it

Sub Find_A_Text()

Dim MyRange As Range
Set MyRange = Range("A:A").Find("100", , xlValues, xlPart)

If Not MyRange Is Nothing Then
    MsgBox MyRange.Row
End If

End Sub

If you are looking for gettting all instances of the Text Try the following




VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Old October 12th, 2007, 06:46 AM
Registered User
Join Date: Oct 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

thank you sir, i really appreciate it!!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about a piece of code chobo2 C# 2008 aka C# 3.0 8 November 30th, 2008 11:53 AM
How to delete a piece of code Charlie05 C# 2005 2 August 3rd, 2008 11:32 AM
This piece of code is giving an error sourik C# 2 July 15th, 2006 09:18 AM
This piece of code is giving an error sourik Classic ASP Databases 1 July 14th, 2006 09:10 PM
What does this piece of code do? mito_lal Oracle 1 July 11th, 2006 06:44 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.