LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default 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




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving text around cells without moving boarder lines Dale Excel Discussion (Misc queries) 1 December 15th 09 06:14 PM
My arrow keys move the spread sheet insted moving between cells Xboxy Setting up and Configuration of Excel 1 July 29th 08 02:34 AM
Arrow Keys Moving Window Frame instead of Moving Between Cells nemmex Excel Discussion (Misc queries) 2 April 9th 07 09:08 AM
Cells(col,row) keep moving to lower case and I can not ref. a cells in a differnet sheet WayneL[_2_] Excel Programming 2 April 25th 05 11:27 PM
Command Buttons on Sheet moving with cells Todd Huttenstine[_2_] Excel Programming 4 November 30th 03 09:23 PM


All times are GMT +1. The time now is 01:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"