Solved

Get Values from 1st Row of Cells in EXCEL

Posted on 2006-11-13
1
146 Views
Last Modified: 2010-05-18
I need the code that will do the following in EXCEL:

1) Go through the first row and get the value from each cell one at a time.
2) If the value in a cell is equal to "expected" then identify what the column is (A, B, C, etc.) and output that value (for the sake of this example just output to a msgbox).

0
Comment
Question by:CVGunx
1 Comment
 
LVL 13

Accepted Solution

by:
rettiseert earned 200 total points
ID: 17930808
This:

    Dim cel As Range
    Dim i As Long
    Dim expected As Double
   
    expected = 1.5
   
   
    For i = 1 To 255
        Set cel = ActiveSheet.Cells(1, i)
        If cel.Value = expected Then
            MsgBox cel.Address
        End If
    Next
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question