Results 1 to 7 of 7

Thread: Find Maximum Value Corresponding To Adjacent Column

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    5
    Rep Power
    0

    Find Maximum Value Corresponding To Adjacent Column

    Hello Everyone,

    Thanks again for the above, I was able to get it to work. Now I have another sub project.

    I have about 3000 rows of data which consists of phone numbers and the date they called. Column A has phone numbers and Column B has the date they called. Phone numbers are repeated in column A and I have sorted it them. I have to choose if the phone number is the same, find the recent date that they called and highlight it. Sometimes people have called multiple times on the same date. Below is my code and I am getting run time error. The code should go only to 3000 rows however it is going through the entire excel.


    Code:
    Sub greaterdate()
    
    Sheets("Sheet1").Select
    
    
    Dim a As Long
    Dim b As Long
    Dim x As Date
    Dim y As Date
    
    
    count = 2
    
    a = Cells(count, 1).Value
    b = Cells(count + 1, 1).Value
    x = Cells(count, 2).Value
    y = Cells(count + 1, 2).Value
    
    
    Do While a = b
       
            
        If x < y Then
        
          Cells(count, 2).Interior.Color = RGB(255, 0, 0)
                          
          ElseIf x = y Then
          Cells(count + 1, 2).Interior.Color = RGB(255, 0, 0)
          
          ElseIf x > y Then
          Cells(count + 1, 2).Interior.Color = RGB(255, 0, 0)
          
          End If
          
        
          count = count + 2
          
          Loop
         
      
    
          End Sub
    Last edited by Admin; 05-21-2013 at 10:23 AM. Reason: code tag added

Similar Threads

  1. Replies: 16
    Last Post: 04-19-2013, 08:20 PM
  2. Replies: 4
    Last Post: 04-05-2013, 12:08 PM
  3. Replies: 3
    Last Post: 08-05-2012, 09:16 PM
  4. Find Last Used Row In Column
    By Rasm in forum Excel and VBA Tips and Tricks
    Replies: 2
    Last Post: 06-04-2012, 07:40 AM
  5. Find The Last Entry Row In A Column That Contains Only Numbers
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 05-09-2011, 05:19 AM

Posting Permissions

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