Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Loop Problem (Excel 2002/2003)

    Hi

    I am trying to learn the Do Loop Process, but the code stops running a Loop, any ideas please

    Thanks Braddy


    Sub BigNumbers()
    Dim rowNum As Integer, ColNum As Interior, currcell As Range
    '
    'Initialize the row and column numbers
    '
    rowNum = ActiveCell.Row
    ColNum = ActiveCell.Column
    '
    'Get the first Cell
    '
    Set currcell = ActiveSheet.Cells(rownnum, ColNum)
    '
    'Loop while the current cell isn't empty
    Do While currcell.Value <> ""
    '
    'Is it a Number?
    If IsNumeric(currcell.Value) >= 1000 Then
    '
    'Is it a big number
    '
    If currcell.Value >= 1000 Then
    '
    ' If so colour it Magenta
    '
    currcell.Font.Color = VBAcolor("Magenta")
    End If
    '
    '
    'Increment the row number and get the next cell
    '
    rowNum = rowNum + 1
    Set currcell = ActiveSheet.Cells(rowNum, ColNum)
    Loop



    End Sub
    If you are a fool at forty, you will always be a fool

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Loop Problem (Excel 2002/2003)

    Use ColNum As Integer instead of ColNum As Interior.
    Use RowNum instead of rownnum.
    You

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    Northampton, Northamptonshire, England
    Posts
    1,951
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Loop Problem (Excel 2002/2003)

    Hi Hans

    Thanks for the typo corrections

    VBAColor is a function as attached.

    Once again Thanks very much, I will try to be more carefull with typo's in the future.

    Braddy
    If you are a fool at forty, you will always be a fool

Posting Permissions

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