Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cut works but not Paste?

Status
Not open for further replies.

WBURKERT

Technical User
May 28, 2010
73
Why do I get an error when trying to do the .paste but not when doing the copy? Just when I think I make progress with understanding I stumble. - This is just a piece of my macro, and think it should be enough for you to see the error in my ways.

Thanks in advace
For sRow = 1 To 3500
If Worksheets("PARTS").Cells(sRow, 5).Text = s And _
Worksheets("PARTS").Cells(sRow, 6).Text = "L" _
Then 'make worksheet ("Sec" & s) two columns
k = i - 1 'equals last row to move
b = (Round(k / 2)) + 1 'first row to cut and paste
i = 1 'equals starting position of second row
For d = b To k
With Worksheets("Sec" & s)
.Cells(d, 1).Copy
.Cells(i, 5).Paste
.Cells(d, 2).Cut
.Cells(i, 6).Paste
.Cells(d, 3).Cut
.Cells(i, 7).Paste
End With
i = i + 1
Next d
Else
End If
Next sRow
 
Paste applies to worksheet, so:
Code:
With Worksheets("Sec" & s)
    .Cells(d,1).Copy
    .Paste Destination:=.Cells(i, 5)
     .Cells(d, 2).Cut
     .Paste Destination:=.Cells(i, 6)
    .Cells(d, 3).Cut
    .Paste Destination:=.Cells(i, 7)
End With

combo
 
Thank-you - the command syntax continues to amaze me because I have the logic down pat but the syntax is difficult for me. Thank-you again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top