Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Dallas plus 20 miles or so, Texas, USA
    Posts
    876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Range Syntax (2000)

    Nevermind, I got it. Problem was not with the Range definition, but with a loop I had in the rest of my code which cut out after the first cell. Thanks!

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Range Syntax (2000)

    I am not sure what you need or what the problem is could you give more details>

    The code in red checks in:
    Cols D - O in rows that have either a row that that PFC Credit Memo or Pilgrims Credit Inv in Col B

    If the value in the cell is > 0 it subtracts double the current value from it. (why don't you just use "-cellr.value"?) and then goes to the next cell.

    Steve

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Dallas plus 20 miles or so, Texas, USA
    Posts
    876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Range Syntax (2000)

    In the code excerpt below I am ensuring that if the user enters a credit invoice, all of the entries in the same row are negative.

    <pre>For Each cell In ThisWorkbook.Sheets("Journal").Range("b8:b64")
    If cell.Value = "PFC Credit Memo" Or cell.Value = "Pilgrims Credit Inv" Then
    For Each cellr In ThisWorkbook.Sheets("Journal"). _
    <font color=red>Range(Cells(cell.Row, 4), Cells(cell.Row, 15))</font color=red>
    If cellr.Value > 0 Then cellr.Value = cellr.Value - (cellr.Value * 2)
    Next
    End If
    Next
    </pre>



    However, the last part of the Range definition in red above does not seem to take all the way out to the end of the row.
    Actually, the first cellr (cell.Row, 4) changes, but the rest of the Range does not. How do I refer to the Range to make
    it take each cellr in the entire Range?

  4. #4
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Dallas plus 20 miles or so, Texas, USA
    Posts
    876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Range Syntax (2000)

    <<(why don't you just use "-cellr.value"?) >>

    No particular reason, just sat down and did it the other way. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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