+ Reply to Thread
Results 1 to 13 of 13

Moving cells to another sheet

  1. #1
    Registered User
    Join Date
    08-28-2005
    Posts
    62

    Moving cells to another sheet

    I got this macro from someone in this forum. It moves two specific cells from one row on a sheet to two cells in a row on another sheet "DRMO". I tried to modify it to move three cells but if I select more than one row and click the button it fills them in horizontally instead of vertically. For this one I need; cell A to cell A, cell BW to cell E, and cell AA to cell I.


    Option Explicit
    Sub DRMO()
    Dim toWks As Worksheet
    Dim actWks As Worksheet
    Dim myRng As Range
    Dim myCell As Range
    Dim iRow As Long
    Dim DestCell As Range

    Set actWks = ActiveSheet
    Set toWks = Worksheets("DRMO")

    Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))

    With toWks
    Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
    End With

    With toWks
    For Each myCell In myRng.Cells
    iRow = myCell.Row
    DestCell.Value = actWks.Cells(iRow, "a").Value
    DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "BW").Value
    Set DestCell = DestCell.Offset(0, 1)
    DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "AA").Value
    Set DestCell = DestCell.Offset(0, 1)
    Application.Goto .Range("a1"), scroll:=True
    Next myCell
    End With
    End Sub

  2. #2
    Dave Peterson
    Guest

    Re: Moving cells to another sheet

    This portion

    With toWks
    For Each myCell In myRng.Cells
    iRow = myCell.Row
    DestCell.Value = actWks.Cells(iRow, "a").Value
    DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "BW").Value
    Set DestCell = DestCell.Offset(0, 1)
    DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "AA").Value
    Set DestCell = DestCell.Offset(0, 1)
    Application.Goto .Range("a1"), scroll:=True
    Next myCell
    End With

    should look more like:

    With toWks
    For Each myCell In myRng.Cells
    iRow = myCell.Row
    DestCell.Value = actWks.Cells(iRow, "a").Value
    DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "BW").Value
    DestCell.Offset(0, 8).Value = actWks.Cells(iRow, "AA").Value
    Set DestCell = DestCell.Offset(0, 1)
    Application.Goto .Range("a1"), scroll:=True
    Next myCell
    End With

    This line essentially moves down one row:
    Set DestCell = DestCell.Offset(0, 1)

    So you only have to do that when you're done plopping in the values for that
    row.

    And the .offset() lines like:
    destcell.offset(x,y).value = ....

    Destcell in in column A. .offset(x,y) says to "move" to x rows (up or down) and
    y columns (right or left).

    range("z99").offset(-1,-2) would "move" one row up and two columns to the left.

    So DestCell.Offset(0, 8).Value = actWks.Cells(iRow, "AA").Value
    moves to the same row (0 rows) and 8 columns to the right.



    Optitron wrote:
    >
    > I got this macro from someone in this forum. It moves two specific cells
    > from one row on a sheet to two cells in a row on another sheet "DRMO". I
    > tried to modify it to move three cells but if I select more than one row
    > and click the button it fills them in horizontally instead of
    > vertically. For this one I need; cell A to cell A, cell BW to cell E,
    > and cell AA to cell I.
    >
    > Option Explicit
    > Sub DRMO()
    > Dim toWks As Worksheet
    > Dim actWks As Worksheet
    > Dim myRng As Range
    > Dim myCell As Range
    > Dim iRow As Long
    > Dim DestCell As Range
    >
    > Set actWks = ActiveSheet
    > Set toWks = Worksheets("DRMO")
    >
    > Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))
    >
    > With toWks
    > Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
    > End With
    >
    > With toWks
    > For Each myCell In myRng.Cells
    > iRow = myCell.Row
    > DestCell.Value = actWks.Cells(iRow, "a").Value
    > DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "BW").Value
    > Set DestCell = DestCell.Offset(0, 1)
    > DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "AA").Value
    > Set DestCell = DestCell.Offset(0, 1)
    > Application.Goto .Range("a1"), scroll:=True
    > Next myCell
    > End With
    > End Sub
    >
    > --
    > Optitron
    > ------------------------------------------------------------------------
    > Optitron's Profile: http://www.excelforum.com/member.php...o&userid=26729
    > View this thread: http://www.excelforum.com/showthread...hreadid=475519


    --

    Dave Peterson

  3. #3
    Registered User
    Join Date
    08-28-2005
    Posts
    62
    With what you gave me it moves column A to column A, and column AA to I, but not BW to E. Also when I try to select more than one row it takes one row and then the next row goes on the next row but over a few cells.
    Is there maybe a simpler way? I just want to select a few rows, click a button and have certain cells in that row moved to the other sheet.

  4. #4
    Rowan Drummond
    Guest

    Re: Moving cells to another sheet

    Dave copied the typo from your original code that offsets to the right
    rather than down. Try:

    Sub DRMO()
    Dim toWks As Worksheet
    Dim actWks As Worksheet
    Dim myRng As Range
    Dim myCell As Range
    Dim iRow As Long
    Dim DestCell As Range

    Set actWks = ActiveSheet
    Set toWks = Worksheets("DRMO")

    Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))

    With toWks
    Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
    End With

    With toWks
    For Each myCell In myRng.Cells
    iRow = myCell.Row
    DestCell.Value = actWks.Cells(iRow, "a").Value
    DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "BW").Value
    DestCell.Offset(0, 8).Value = actWks.Cells(iRow, "AA").Value
    Set DestCell = DestCell.Offset(1, 0) '<<<changed
    Application.Goto .Range("a1"), scroll:=True
    Next myCell
    End With
    End Sub

    Hope this helps
    Rowan

    Optitron wrote:
    > With what you gave me it moves column A to column A, and column AA to I,
    > but not BW to E. Also when I try to select more than one row it takes
    > one row and then the next row goes on the next row but over a few
    > cells.
    > Is there maybe a simpler way? I just want to select a few rows, click
    > a button and have certain cells in that row moved to the other sheet.
    >
    >


  5. #5
    Dave Peterson
    Guest

    Re: Moving cells to another sheet

    Good eyes!

    Thanks for the correction.

    Rowan Drummond wrote:
    >
    > Dave copied the typo from your original code that offsets to the right
    > rather than down. Try:
    >
    > Sub DRMO()
    > Dim toWks As Worksheet
    > Dim actWks As Worksheet
    > Dim myRng As Range
    > Dim myCell As Range
    > Dim iRow As Long
    > Dim DestCell As Range
    >
    > Set actWks = ActiveSheet
    > Set toWks = Worksheets("DRMO")
    >
    > Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))
    >
    > With toWks
    > Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
    > End With
    >
    > With toWks
    > For Each myCell In myRng.Cells
    > iRow = myCell.Row
    > DestCell.Value = actWks.Cells(iRow, "a").Value
    > DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "BW").Value
    > DestCell.Offset(0, 8).Value = actWks.Cells(iRow, "AA").Value
    > Set DestCell = DestCell.Offset(1, 0) '<<<changed
    > Application.Goto .Range("a1"), scroll:=True
    > Next myCell
    > End With
    > End Sub
    >
    > Hope this helps
    > Rowan
    >
    > Optitron wrote:
    > > With what you gave me it moves column A to column A, and column AA to I,
    > > but not BW to E. Also when I try to select more than one row it takes
    > > one row and then the next row goes on the next row but over a few
    > > cells.
    > > Is there maybe a simpler way? I just want to select a few rows, click
    > > a button and have certain cells in that row moved to the other sheet.
    > >
    > >


    --

    Dave Peterson

  6. #6
    Registered User
    Join Date
    08-28-2005
    Posts
    62
    Will that code help me with this?

    Move the selected row: column B, C, E, F, M, N - from sheet "NSN LIST REF"

    to column A, B, D, E, F, G - sheet "3 BIN".

    Starting at row 1 and each active row moved needs to go 5 rows apart (rows 1, 6, 11, 16, 21, etc...)

  7. #7
    Don Guillett
    Guest

    Re: Moving cells to another sheet

    Since you did not top post to the original message, it's difficult to say if
    THAT code will.

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Optitron" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Will that code help me with this?
    >
    > Move the selected row: column B, C, E, F, M, N - from sheet "NSN LIST
    > REF"
    >
    > to column A, B, D, E, F, G - sheet "3 BIN".
    >
    > Starting at row 1 and each active row moved needs to go 5 rows apart
    > (rows 1, 6, 11, 16, 21, etc...)
    >
    >
    > --
    > Optitron
    > ------------------------------------------------------------------------
    > Optitron's Profile:

    http://www.excelforum.com/member.php...o&userid=26729
    > View this thread: http://www.excelforum.com/showthread...hreadid=475519
    >




  8. #8
    Registered User
    Join Date
    08-28-2005
    Posts
    62
    Will that code help me with this?

    Move the selected row: column B, C, E, F, M, N - from sheet "NSN LIST REF"

    to column A, B, D, E, F, G - sheet "3 BIN".

    Starting at row 1 and each active row moved needs to go 5 rows apart (rows 1, 6, 11, 16, 21, etc...)

    Quote Originally Posted by Dave Peterson
    Good eyes!

    Thanks for the correction.

    Rowan Drummond wrote:
    >
    > Dave copied the typo from your original code that offsets to the right
    > rather than down. Try:
    >
    > Sub DRMO()
    > Dim toWks As Worksheet
    > Dim actWks As Worksheet
    > Dim myRng As Range
    > Dim myCell As Range
    > Dim iRow As Long
    > Dim DestCell As Range
    >
    > Set actWks = ActiveSheet
    > Set toWks = Worksheets("DRMO")
    >
    > Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))
    >
    > With toWks
    > Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
    > End With
    >
    > With toWks
    > For Each myCell In myRng.Cells
    > iRow = myCell.Row
    > DestCell.Value = actWks.Cells(iRow, "a").Value
    > DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "BW").Value
    > DestCell.Offset(0, 8).Value = actWks.Cells(iRow, "AA").Value
    > Set DestCell = DestCell.Offset(1, 0) '<<<changed
    > Application.Goto .Range("a1"), scroll:=True
    > Next myCell
    > End With
    > End Sub
    >
    > Hope this helps
    > Rowan
    >
    > Optitron wrote:
    > > With what you gave me it moves column A to column A, and column AA to I,
    > > but not BW to E. Also when I try to select more than one row it takes
    > > one row and then the next row goes on the next row but over a few
    > > cells.
    > > Is there maybe a simpler way? I just want to select a few rows, click
    > > a button and have certain cells in that row moved to the other sheet.
    > >
    > >


    --

    Dave Peterson

  9. #9
    Rowan Drummond
    Guest

    Re: Moving cells to another sheet

    Try:

    Sub DRMO2()
    Dim toWks As Worksheet
    Dim actWks As Worksheet
    Dim myRng As Range
    Dim myCell As Range
    Dim iRow As Long
    Dim DestCell As Range

    Set actWks = ActiveSheet
    Set toWks = Worksheets("3 BIN")

    Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))

    With toWks
    If .Cells(.Rows.Count, "A").End(xlUp).Row = 1 Then
    Set DestCell = .Cells(1, 1)
    Else
    Set DestCell = .Cells(.Rows.Count, "A").End(xlUp). _
    Offset(5, 0)
    End If
    End With

    With toWks
    For Each myCell In myRng.Cells
    iRow = myCell.Row
    DestCell.Value = actWks.Cells(iRow, "B").Value
    DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "C").Value
    DestCell.Offset(0, 3).Value = actWks.Cells(iRow, "E").Value
    DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "F").Value
    DestCell.Offset(0, 5).Value = actWks.Cells(iRow, "M").Value
    DestCell.Offset(0, 6).Value = actWks.Cells(iRow, "N").Value
    Set DestCell = DestCell.Offset(5, 0)
    Application.Goto .Range("a1"), scroll:=True
    Next myCell
    End With
    End Sub

    Regards
    Rowan

    Optitron wrote:
    > Will that code help me with this?
    >
    > Move the selected row: column B, C, E, F, M, N - from sheet "NSN LIST
    > REF"
    >
    > to column A, B, D, E, F, G - sheet "3 BIN".
    >
    > Starting at row 1 and each active row moved needs to go 5 rows apart
    > (rows 1, 6, 11, 16, 21, etc...)
    >
    > Dave Peterson Wrote:
    >
    >>Good eyes!
    >>
    >>Thanks for the correction.
    >>
    >>Rowan Drummond wrote:
    >>
    >>>Dave copied the typo from your original code that offsets to the

    >>
    >>right
    >>
    >>>rather than down. Try:
    >>>
    >>>Sub DRMO()
    >>> Dim toWks As Worksheet
    >>> Dim actWks As Worksheet
    >>> Dim myRng As Range
    >>> Dim myCell As Range
    >>> Dim iRow As Long
    >>> Dim DestCell As Range
    >>>
    >>> Set actWks = ActiveSheet
    >>> Set toWks = Worksheets("DRMO")
    >>>
    >>> Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))
    >>>
    >>> With toWks
    >>> Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1,

    >>
    >>0)
    >>
    >>> End With
    >>>
    >>> With toWks
    >>> For Each myCell In myRng.Cells
    >>> iRow = myCell.Row
    >>> DestCell.Value = actWks.Cells(iRow, "a").Value
    >>> DestCell.Offset(0, 4).Value = actWks.Cells(iRow,

    >>
    >>"BW").Value
    >>
    >>> DestCell.Offset(0, 8).Value = actWks.Cells(iRow,

    >>
    >>"AA").Value
    >>
    >>> Set DestCell = DestCell.Offset(1, 0) '<<<changed
    >>> Application.Goto .Range("a1"), scroll:=True
    >>> Next myCell
    >>> End With
    >>>End Sub
    >>>
    >>>Hope this helps
    >>>Rowan
    >>>
    >>>Optitron wrote:
    >>>
    >>>>With what you gave me it moves column A to column A, and column AA

    >>
    >>to I,
    >>
    >>>>but not BW to E. Also when I try to select more than one row it

    >>
    >>takes
    >>
    >>>>one row and then the next row goes on the next row but over a few
    >>>>cells.
    >>>>Is there maybe a simpler way? I just want to select a few rows,

    >>
    >>click
    >>
    >>>>a button and have certain cells in that row moved to the other

    >>
    >>sheet.
    >>
    >>>>

    >>--
    >>
    >>Dave Peterson

    >
    >
    >


  10. #10
    Registered User
    Join Date
    08-28-2005
    Posts
    62
    That worked perfectly. Thank you. Now, how do I get that info to clear in "3 BIN" before it moves it? Let's say I selected 8 rows and clicked the button, now I want to replace it with the next 8 rows. Is there something to add to that code or should I have another button? Here's the new code after I had to tweek(red) it a little:

    Sub THREEBIN()
    Dim toWks As Worksheet
    Dim actWks As Worksheet
    Dim myRng As Range
    Dim myCell As Range
    Dim iRow As Long
    Dim DestCell As Range

    Set actWks = ActiveSheet
    Set toWks = Worksheets("3 BIN")

    Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))

    With toWks
    If .Cells(.Rows.Count, "A").End(xlUp).Row = 1 Then
    Set DestCell = .Cells(1, 1)
    Else
    Set DestCell = .Cells(.Rows.Count, "A").End(xlUp). _
    Offset(7, 0)
    End If
    End With

    With toWks
    For Each myCell In myRng.Cells
    iRow = myCell.Row
    DestCell.Value = actWks.Cells(iRow, "B").Value
    DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "C").Value
    DestCell.Offset(0, 3).Value = actWks.Cells(iRow, "E").Value
    DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "F").Value
    DestCell.Offset(0, 22).Value = actWks.Cells(iRow, "M").Value
    DestCell.Offset(1, 4).Value = actWks.Cells(iRow, "N").Value
    Set DestCell = DestCell.Offset(7, 0)

    Application.Goto .Range("a1"), scroll:=True
    Next myCell
    End With
    End Sub

    [QUOTE=Rowan Drummond]Try:

    Sub DRMO2()
    Dim toWks As Worksheet
    Dim actWks As Worksheet
    Dim myRng As Range
    Dim myCell As Range
    Dim iRow As Long
    Dim DestCell As Range

    Set actWks = ActiveSheet
    Set toWks = Worksheets("3 BIN")

    Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))

    With toWks
    If .Cells(.Rows.Count, "A").End(xlUp).Row = 1 Then
    Set DestCell = .Cells(1, 1)
    Else
    Set DestCell = .Cells(.Rows.Count, "A").End(xlUp). _
    Offset(5, 0)
    End If
    End With

    With toWks
    For Each myCell In myRng.Cells
    iRow = myCell.Row
    DestCell.Value = actWks.Cells(iRow, "B").Value
    DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "C").Value
    DestCell.Offset(0, 3).Value = actWks.Cells(iRow, "E").Value
    DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "F").Value
    DestCell.Offset(0, 5).Value = actWks.Cells(iRow, "M").Value
    DestCell.Offset(0, 6).Value = actWks.Cells(iRow, "N").Value
    Set DestCell = DestCell.Offset(5, 0)
    Application.Goto .Range("a1"), scroll:=True
    Next myCell
    End With
    End Sub

    Regards
    Rowan

  11. #11
    Rowan Drummond
    Guest

    Re: Moving cells to another sheet

    Hi Harold

    I'm afraid I have not understood the question. Do you want to delete the
    rows moved to "3 BIN", delete the values of the specific cells moved or
    simply clear the selection?

    Regards
    Rowan

    Optitron wrote:
    > That worked perfectly. Thank you. Now, how do I get that info to clear
    > in "3 BIN" before it moves it? Let's say I selected 8 rows and clicked
    > the button, now I want to replace it with the next 8 rows. Is there
    > something to add to that code or should I have another button? Here's
    > the new code after I had to tweek(red) it a little:
    >
    > Sub THREEBIN()
    > Dim toWks As Worksheet
    > Dim actWks As Worksheet
    > Dim myRng As Range
    > Dim myCell As Range
    > Dim iRow As Long
    > Dim DestCell As Range
    >
    > Set actWks = ActiveSheet
    > Set toWks = Worksheets("3 BIN")
    >
    > Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))
    >
    > With toWks
    > If .Cells(.Rows.Count, "A").End(xlUp).Row = 1 Then
    > Set DestCell = .Cells(1, 1)
    > Else
    > Set DestCell = .Cells(.Rows.Count, "A").End(xlUp). _
    > Offset(7, 0)
    > End If
    > End With
    >
    > With toWks
    > For Each myCell In myRng.Cells
    > iRow = myCell.Row
    > DestCell.Value = actWks.Cells(iRow, "B").Value
    > DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "C").Value
    > DestCell.Offset(0, 3).Value = actWks.Cells(iRow, "E").Value
    > DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "F").Value
    > DestCell.Offset(0, 22).Value = actWks.Cells(iRow, "M").Value
    > DestCell.Offset(1, 4).Value = actWks.Cells(iRow, "N").Value
    > Set DestCell = DestCell.Offset(7, 0)
    > Application.Goto .Range("a1"), scroll:=True
    > Next myCell
    > End With
    > End Sub
    >
    > Rowan Drummond Wrote:
    >
    >>Try:
    >>
    >>Sub DRMO2()
    >>Dim toWks As Worksheet
    >>Dim actWks As Worksheet
    >>Dim myRng As Range
    >>Dim myCell As Range
    >>Dim iRow As Long
    >>Dim DestCell As Range
    >>
    >>Set actWks = ActiveSheet
    >>Set toWks = Worksheets("3 BIN")
    >>
    >>Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))
    >>
    >>With toWks
    >>If .Cells(.Rows.Count, "A").End(xlUp).Row = 1 Then
    >>Set DestCell = .Cells(1, 1)
    >>Else
    >>Set DestCell = .Cells(.Rows.Count, "A").End(xlUp). _
    >>Offset(5, 0)
    >>End If
    >>End With
    >>
    >>With toWks
    >>For Each myCell In myRng.Cells
    >>iRow = myCell.Row
    >>DestCell.Value = actWks.Cells(iRow, "B").Value
    >>DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "C").Value
    >>DestCell.Offset(0, 3).Value = actWks.Cells(iRow, "E").Value
    >>DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "F").Value
    >>DestCell.Offset(0, 5).Value = actWks.Cells(iRow, "M").Value
    >>DestCell.Offset(0, 6).Value = actWks.Cells(iRow, "N").Value
    >>Set DestCell = DestCell.Offset(5, 0)
    >>Application.Goto .Range("a1"), scroll:=True
    >>Next myCell
    >>End With
    >>End Sub
    >>
    >>Regards
    >>Rowan

    >
    >
    >


  12. #12
    Rowan Drummond
    Guest

    Re: Moving cells to another sheet

    Hi Harold

    I'm afraid I have not understood the question. Do you want to delete the
    rows moved to "3 BIN", delete the values of the specific cells moved or
    simply clear the selection?

    Regards
    Rowan

    Optitron wrote:
    > That worked perfectly. Thank you. Now, how do I get that info to clear
    > in "3 BIN" before it moves it? Let's say I selected 8 rows and clicked
    > the button, now I want to replace it with the next 8 rows. Is there
    > something to add to that code or should I have another button? Here's
    > the new code after I had to tweek(red) it a little:
    >
    > Sub THREEBIN()
    > Dim toWks As Worksheet
    > Dim actWks As Worksheet
    > Dim myRng As Range
    > Dim myCell As Range
    > Dim iRow As Long
    > Dim DestCell As Range
    >
    > Set actWks = ActiveSheet
    > Set toWks = Worksheets("3 BIN")
    >
    > Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))
    >
    > With toWks
    > If .Cells(.Rows.Count, "A").End(xlUp).Row = 1 Then
    > Set DestCell = .Cells(1, 1)
    > Else
    > Set DestCell = .Cells(.Rows.Count, "A").End(xlUp). _
    > Offset(7, 0)
    > End If
    > End With
    >
    > With toWks
    > For Each myCell In myRng.Cells
    > iRow = myCell.Row
    > DestCell.Value = actWks.Cells(iRow, "B").Value
    > DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "C").Value
    > DestCell.Offset(0, 3).Value = actWks.Cells(iRow, "E").Value
    > DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "F").Value
    > DestCell.Offset(0, 22).Value = actWks.Cells(iRow, "M").Value
    > DestCell.Offset(1, 4).Value = actWks.Cells(iRow, "N").Value
    > Set DestCell = DestCell.Offset(7, 0)
    > Application.Goto .Range("a1"), scroll:=True
    > Next myCell
    > End With
    > End Sub
    >
    > Rowan Drummond Wrote:
    >
    >>Try:
    >>
    >>Sub DRMO2()
    >>Dim toWks As Worksheet
    >>Dim actWks As Worksheet
    >>Dim myRng As Range
    >>Dim myCell As Range
    >>Dim iRow As Long
    >>Dim DestCell As Range
    >>
    >>Set actWks = ActiveSheet
    >>Set toWks = Worksheets("3 BIN")
    >>
    >>Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))
    >>
    >>With toWks
    >>If .Cells(.Rows.Count, "A").End(xlUp).Row = 1 Then
    >>Set DestCell = .Cells(1, 1)
    >>Else
    >>Set DestCell = .Cells(.Rows.Count, "A").End(xlUp). _
    >>Offset(5, 0)
    >>End If
    >>End With
    >>
    >>With toWks
    >>For Each myCell In myRng.Cells
    >>iRow = myCell.Row
    >>DestCell.Value = actWks.Cells(iRow, "B").Value
    >>DestCell.Offset(0, 1).Value = actWks.Cells(iRow, "C").Value
    >>DestCell.Offset(0, 3).Value = actWks.Cells(iRow, "E").Value
    >>DestCell.Offset(0, 4).Value = actWks.Cells(iRow, "F").Value
    >>DestCell.Offset(0, 5).Value = actWks.Cells(iRow, "M").Value
    >>DestCell.Offset(0, 6).Value = actWks.Cells(iRow, "N").Value
    >>Set DestCell = DestCell.Offset(5, 0)
    >>Application.Goto .Range("a1"), scroll:=True
    >>Next myCell
    >>End With
    >>End Sub
    >>
    >>Regards
    >>Rowan

    >
    >
    >


  13. #13
    Registered User
    Join Date
    08-28-2005
    Posts
    62
    I have 16 rows of data to move to "3 BIN". I only want one form in "3 BIN", so when I move 8 rows over and print, I will need to clear those out to put in the other 8 rows of data and print out the form again. Now that I think about it you can't put anything is this code to do that. I'll need another button and code to clear those values of the specific cells moved from "3 BIN".

    [QUOTE=Rowan Drummond]Hi Harold

    I'm afraid I have not understood the question. Do you want to delete the
    rows moved to "3 BIN", delete the values of the specific cells moved or
    simply clear the selection?

    Regards
    Rowan

+ 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