+ Reply to Thread
Results 1 to 3 of 3

Row incrementation not working.

  1. #1
    Brian
    Guest

    Row incrementation not working.

    I am trying to compare rows on two worksheets in same workbook. The compare
    should work but when I try to increment down using hte counter it blows up. I
    have a little experience with c and this works there. All help appreciated!

    Sub Compare_Tests()
    Dim i As Integer ' use to increment thru worksheet
    Dim cutrange As Range ' new data to move if changed

    i = 3 'counter

    Do Until IsEmpty(Cells(i, 1)) 'runs entire length of all sheets in variable
    sizes
    If Worksheets("well tests").Range("si") <>
    Worksheets("sheet1").Range("ti") Then ' if AOF <>
    Set cutrange = ("Hi:Oi") 'cut observations
    cutrange.Cut Destination:=Worksheets("well tests").Range("Gi:Ni") ' paste
    Worksheets("well tests").Range("ai").Value = "new" ' identify as new
    End If
    i = i + 1 ' move down a row
    Exit Do

  2. #2
    Tom Ogilvy
    Guest

    Re: Row incrementation not working.

    Sub Compare_Tests()
    Dim i As Integer ' use to increment thru worksheet
    Dim cutrange As Range ' new data to move if changed

    i = 3 'counter

    Do Until IsEmpty(Cells(i, 1)) 'runs entire length of all sheets in variable
    sizes
    If Worksheets("well tests").Range("s" & i) <> _
    Worksheets("sheet1").Range("t" & i) Then
    ' if AOF <>
    Set cutrange = ("H" & i & ":O" & i) 'cut observations
    cutrange.Cut Destination:=Worksheets("well tests").Range("G" & _
    i & ":" & N" & i) ' paste
    Worksheets("well tests").Range("a" & i).Value = "new" ' identify as
    new
    End If
    i = i + 1 ' move down a row
    Exit Do

    Spacing is important. i & and i& are two different things (for example)

    i& means i has a type of long (implicit typing)

    i & uses & as a concatenation operator

    you want the latter.

    --
    Regards,
    Tom Ogilvy


    "Brian" <[email protected]> wrote in message
    news:[email protected]...
    > I am trying to compare rows on two worksheets in same workbook. The

    compare
    > should work but when I try to increment down using hte counter it blows

    up. I
    > have a little experience with c and this works there. All help

    appreciated!
    >
    > Sub Compare_Tests()
    > Dim i As Integer ' use to increment thru worksheet
    > Dim cutrange As Range ' new data to move if changed
    >
    > i = 3 'counter
    >
    > Do Until IsEmpty(Cells(i, 1)) 'runs entire length of all sheets in

    variable
    > sizes
    > If Worksheets("well tests").Range("si") <>
    > Worksheets("sheet1").Range("ti") Then ' if AOF <>
    > Set cutrange = ("Hi:Oi") 'cut observations
    > cutrange.Cut Destination:=Worksheets("well tests").Range("Gi:Ni") '

    paste
    > Worksheets("well tests").Range("ai").Value = "new" ' identify as new
    > End If
    > i = i + 1 ' move down a row
    > Exit Do




  3. #3
    Brian
    Guest

    Re: Row incrementation not working.

    Thanks Tom for the quick reply. I did not know about theimplicit type siiue
    (not in my book)

    "Tom Ogilvy" wrote:

    > Sub Compare_Tests()
    > Dim i As Integer ' use to increment thru worksheet
    > Dim cutrange As Range ' new data to move if changed
    >
    > i = 3 'counter
    >
    > Do Until IsEmpty(Cells(i, 1)) 'runs entire length of all sheets in variable
    > sizes
    > If Worksheets("well tests").Range("s" & i) <> _
    > Worksheets("sheet1").Range("t" & i) Then
    > ' if AOF <>
    > Set cutrange = ("H" & i & ":O" & i) 'cut observations
    > cutrange.Cut Destination:=Worksheets("well tests").Range("G" & _
    > i & ":" & N" & i) ' paste
    > Worksheets("well tests").Range("a" & i).Value = "new" ' identify as
    > new
    > End If
    > i = i + 1 ' move down a row
    > Exit Do
    >
    > Spacing is important. i & and i& are two different things (for example)
    >
    > i& means i has a type of long (implicit typing)
    >
    > i & uses & as a concatenation operator
    >
    > you want the latter.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Brian" <[email protected]> wrote in message
    > news:[email protected]...
    > > I am trying to compare rows on two worksheets in same workbook. The

    > compare
    > > should work but when I try to increment down using hte counter it blows

    > up. I
    > > have a little experience with c and this works there. All help

    > appreciated!
    > >
    > > Sub Compare_Tests()
    > > Dim i As Integer ' use to increment thru worksheet
    > > Dim cutrange As Range ' new data to move if changed
    > >
    > > i = 3 'counter
    > >
    > > Do Until IsEmpty(Cells(i, 1)) 'runs entire length of all sheets in

    > variable
    > > sizes
    > > If Worksheets("well tests").Range("si") <>
    > > Worksheets("sheet1").Range("ti") Then ' if AOF <>
    > > Set cutrange = ("Hi:Oi") 'cut observations
    > > cutrange.Cut Destination:=Worksheets("well tests").Range("Gi:Ni") '

    > paste
    > > Worksheets("well tests").Range("ai").Value = "new" ' identify as new
    > > End If
    > > i = i + 1 ' move down a row
    > > Exit Do

    >
    >
    >


+ 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