+ Reply to Thread
Results 1 to 3 of 3

Check each row of excel sheet for values using VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    09-05-2012
    Location
    Cape Town
    MS-Off Ver
    Excel 2010
    Posts
    6

    Check each row of excel sheet for values using VBA

    Hi All

    I have the working code for checking each row for values and then popping up with a message box if the value is found. The problem is that the code runs from the bottom up and I need the code to run from the top down.

    The code, which works perfectly, but just not from the top down is
    Sub Button1_Click()
    
    Dim i As Long
    For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
    Cells(i, 1).Select
    
    If Cells(i, 2) = "1" Then MsgBox "Yahoo"
    
    If Cells(i, 3) = "1" Then MsgBox "Yahoo again"
    
    Next i
    End Sub

    Thanks

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Check each row of excel sheet for values using VBA

    Change this
    For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
    To
    For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    09-05-2012
    Location
    Cape Town
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Check each row of excel sheet for values using VBA

    Thanks Sixthsense

    This works. Now I wonder if you are able to help me with the next step. Instead of the msgbox "yahoo" and "yahoo again" popping up when a value is found I would like an image to be displayed, briefly appear and then disappear until the next "1" is found.

    Thanks again for your help Thusfar.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1