Solved

Get Values from 1st Row of Cells in EXCEL

Posted on 2006-11-13
1
140 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now