Results 1 to 10 of 10

VBA multi row highlight issue

Threaded View

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    5

    VBA multi row highlight issue

    Hello,

    I am working in Access to export a query to Excel. The number of records varies depending on the parameters selected. If there are more than 1000 records I would like to highlight alternating blocks of 1000 records. I sort of have it working, but not quite the way I would like it. Although I understand the problem, my VBA skills aren't particularly great and I'm having trouble figuring out how to fix my issue.

    The problem is that the last block is unlikely to have exactly 1000 records in it, but it's set to highlight 1000 so I need it to look at the selection and only highlight the number of filled cells. The second is that because it alternates colours it also continues 1 block of 1000 past empty cells.

    Any help is greatly appreciated!!


    ----------------------



    If rst.RecordCount > 1000 Then
    
    Do Until IsEmpty(ApXL.ActiveCell.Offset(1, 0))
    
        ApXL.ActiveCell.Range("A2:C" & 1000).Interior.ColorIndex = 15
        
    
        ApXL.ActiveCell.Range("A1:C1").Offset(1000, 0).SELECT
        ApXL.Selection.Resize(1000, 1).SELECT
        ApXL.Selection.Interior.ColorIndex = 2
        
        ApXL.ActiveCell.Range("A1:C1").Offset(1000, 0).SELECT
        ApXL.Selection.Resize(1000, 1).SELECT
        ApXL.Selection.Interior.ColorIndex = 15
    
    Loop
    
    End If
    Last edited by arlu1201; 07-01-2013 at 01:56 AM. Reason: Use code tags in future.

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