Consulting

Results 1 to 2 of 2

Thread: How do you read all cells in a row?

  1. #1

    How do you read all cells in a row?

    Hi guys,

    I'm a newbie. I was reading this excel vba book, and I couldn't figure it out. I need to know how to read all cells in a specific row to see whether it matches a particular cell with a hard-coded value. Your help is greatly appreciated.

  2. #2
    VBAX Contributor GarysStudent's Avatar
    Joined
    Aug 2012
    Location
    Lakehurst, NJ, USA
    Posts
    127
    Location
    Give this a try:

    [VBA]Sub RowCheck()
    Dim v As Variant
    v = Range("A1").Value
    For Each cel In Rows(11).Cells
    If cel.Value = v Then
    MsgBox "Value found in cell " & cel.Address
    Exit Sub
    End If
    Next
    MsgBox "Value not found"
    End Sub
    [/VBA]
    Have a Great Day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •