Announcement

Collapse
No announcement yet.

Copy Active Cell Down Adjacent Range To Right

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Copy Active Cell Down Adjacent Range To Right



    Split from: http://www.ozgrid.com/forum/showthread.php?t=135940

    Thanks, as I was working through this the first step was to clear the contents of the cells. After they are cleared, I have another sub that then goes and retreives a unquie number and places it back at the top of the column that I just cleared.

    Would this same code that cleared the cells contents work to copy the contents of the active cell down that same column, until the cell to its right is blank? -R-
    Last edited by Dave Hawley; April 18th, 2009, 07:21.
    -R-

  • #2
    Re: Clear Range To Right Of Active Cell Down

    Randal

    Why do you need to clear the contents and then repopulate them?

    You should be able to put in the new value in one go.
    Boo!

    Comment


    • #3
      Re: Clear Range To Right Of Active Cell Down

      Here is the reason.. a given group of lines are saved as a group. (6-10 lines per group) and at the time of saving them all lines are assigned the same unique grp number. These grp numbers have a set of defined fields with values.

      One of the functions of the program I am working on, the user can go into the list of unique group numbers, select one, which imports that previously set of configured values, back into what I am calling the "configurater". I need to strip the old unique grp number so that after values are chg'ed to the users liking... they will have the option to resave it, however when saving it I have to reassign a new unique grp number to it. thus repopulating the cells with that new grp number leaving the old number intact and the new becomes a varient of the old, having to unique grps now.

      Hope this made sense! The first reply to this thread clears the cells nicely. I have another sub that gets the next unique number in sequence and pastes it to the first line of the new grp.

      Now all I have to do is copy that new grp number in the active cell down the rest of the colum until the cell to its right is blank.

      Actually the original code provided, clears the cells to the right... instead of the ones in the active column, but all I am doing with that, is chg'ing the starting point to one cell left of the one I want to chg... it works for what I need. Sorry for the lengthy reply... you asked..

      So do you have something that can use to copy what is in the active cell, down its own column, until a blank cell appears just to its right?
      -R-
      -R-

      Comment


      • #4
        Re: Copy Active Cell Down Adjacent Range To Right

        Code:
        Sub FillActiveCellDownToRight()
            If Not IsEmpty(ActiveCell(1, 2)) Then
                Range(ActiveCell(1, 2), _
                Cells(Rows.Count, ActiveCell.Column + 1).End(xlUp)) = ActiveCell
            End If
        End Sub

        Comment


        • #5
          Re: Copy Active Cell Down Adjacent Range To Right

          This is very close to what I need. Problem is that when I select a active cell, it copies that value in the next column to the right, when I need it to copy down its own column the value of the active cell.

          What I am doing is after clearing the contents of a column, I am putting a unique value.. at the top of that column, and I need that value copied down. (not the one to its left.) It would stop when it detects a blank cell the the column to its right.

          Basically whatever is in the active cell. Copy that down the same column as the active cell, until the cell to its right is blank. -R-
          -R-

          Comment


          • #6


            Re: Copy Active Cell Down Adjacent Range To Right

            I was play with this and got it!!
            Code:
            Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column + 1).End(xlUp).Offset(, -1)).Value = ActiveCell.Value
            -R-

            Comment

            Working...
            X