+ Reply to Thread
Results 1 to 7 of 7

Code stops when high lighting (Chips code)

  1. #1
    ste mac
    Guest

    Code stops when high lighting (Chips code)

    Hi, I altered the code below (written by Chip, in this ng)
    To highlight the top ten values... the code stops at 'Next icell'
    and I don't know why!

    Does it need error trapping or is it because there could be two
    equal values ranked 10th which would give 11 highest values?

    any help would be gratefully recieved... cheers...

    ste

    Sub topten()
    Sheets("All Data").Select
    Dim rng As Range
    Dim icell As Variant
    Dim TheLarge As Long

    Set rng = Sheets(4).[N3:N18502].SpecialCells(xlCellTypeConstants,
    xlNumbers)
    TheLarge = Application.Large(rng, 10)

    For Each icell In rng
    If icell.Value >= TheLarge Then icell.Interior.ColorIndex = 4

    Next icell '<stops here

    End Sub


  2. #2
    Bob Phillips
    Guest

    Re: Code stops when high lighting (Chips code)

    It works fine for me, even with 11 values satisfying the test.

    Bit of a long shot, but in the VBIDE, go into Tools>References, and see if
    any items are marked as MISSING. Uncheck them if so.

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "ste mac" <thunderman1@hotmail.com> wrote in message
    news:1146472439.767202.40510@g10g2000cwb.googlegroups.com...
    > Hi, I altered the code below (written by Chip, in this ng)
    > To highlight the top ten values... the code stops at 'Next icell'
    > and I don't know why!
    >
    > Does it need error trapping or is it because there could be two
    > equal values ranked 10th which would give 11 highest values?
    >
    > any help would be gratefully recieved... cheers...
    >
    > ste
    >
    > Sub topten()
    > Sheets("All Data").Select
    > Dim rng As Range
    > Dim icell As Variant
    > Dim TheLarge As Long
    >
    > Set rng = Sheets(4).[N3:N18502].SpecialCells(xlCellTypeConstants,
    > xlNumbers)
    > TheLarge = Application.Large(rng, 10)
    >
    > For Each icell In rng
    > If icell.Value >= TheLarge Then icell.Interior.ColorIndex = 4
    >
    > Next icell '<stops here
    >
    > End Sub
    >




  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Another possibility

    I seem to remmeber having a problem some time ago in Excel 97 where the code was acting if I had set a breakpoint on a line of code even though one was not showing. This occured even after closing and reopening the workbook, Excel and re-booting the pc

    I over came the problem by entering a new line of code the same as the one where the macro was stopping then deleting the line of code that the macro stops on

  4. #4
    stemac@gmail.com
    Guest

    Re: Code stops when high lighting (Chips code)

    Thanks Bob and mudraker...

    Thanks for your help boys... it works like a dream...

    ste


  5. #5
    Bob Phillips
    Guest

    Re: Code stops when high lighting (Chips code)

    Which was it? I am intrigued because I have never heard of the problem that
    mudraker raised before.

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    <stemac@gmail.com> wrote in message
    news:1146497210.104546.180460@i40g2000cwc.googlegroups.com...
    > Thanks Bob and mudraker...
    >
    > Thanks for your help boys... it works like a dream...
    >
    > ste
    >




  6. #6
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Bob

    I only ever expeirenced it with the macro of one workbook. It involved the only line of code within an If statement that only got triggered approx once or twice a week (macro run at least 3 times aday) and took me ages to track down . This was before I ever found this forum. I do not remember all the fixes I tried. I only remember it was a paine in the butt to deal with at the time.

  7. #7
    Bob Phillips
    Guest

    Re: Code stops when high lighting (Chips code)

    Thanks. Sounds like a corruption of the workbook perhaps.

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "mudraker" <mudraker.276iun_1146571804.7572@excelforum-nospam.com> wrote in
    message news:mudraker.276iun_1146571804.7572@excelforum-nospam.com...
    >
    > Bob
    >
    > I only ever expeirenced it with the macro of one workbook. It involved
    > the only line of code within an If statement that only got triggered
    > approx once or twice a week (macro run at least 3 times aday) and took
    > me ages to track down . This was before I ever found this forum. I do
    > not remember all the fixes I tried. I only remember it was a paine in
    > the butt to deal with at the time.
    >
    >
    > --
    > mudraker
    > ------------------------------------------------------------------------
    > mudraker's Profile:

    http://www.excelforum.com/member.php...fo&userid=2473
    > View this thread: http://www.excelforum.com/showthread...hreadid=537676
    >




+ 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