Results 1 to 2 of 2

Thread: [RESOLVED] Premature loop ending

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2005
    Posts
    129

    Resolved [RESOLVED] Premature loop ending

    The following code is not working properly...it works for the first cell but then it quits even though there is value in the adjoining cell

    Sub Downtime()
    Range("G1").Select
    For q = 0 To 500
    ActiveCell.Value = ActiveCell.Offset(0, 1).Value - ActiveCell.Offset(0, 2).Value
    ActiveCell.Offset(1, 0).Select
    If ActiveCell.Offset(0, 1).Value = "" Then
    Exit For
    End If
    Next
    End Sub

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Premature loop ending

    As I thought: You are checking Columns (to the right)

    Returns a Range object that represents a range that’s offset from the specified range. Read-only.

    expression.Offset(RowOffset, ColumnOffset)

    expression Required. An expression that returns a Range object.

    RowOffset Optional Variant. The number of rows (positive, negative, or 0 (zero)) by which the range is to be offset. Positive values are offset downward, and negative values are offset upward. The default value is 0.

    ColumnOffset Optional Variant. The number of columns (positive, negative, or 0 (zero)) by which the range is to be offset. Positive values are offset to the right, and negative values are offset to the left. The default value is 0.

Posting Permissions

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



Click Here to Expand Forum to Full Width