Results 1 to 9 of 9

Thread: VBA: Cut and Paste Not Working

  1. #1
    Seeker Pahickham's Avatar
    Join Date
    Jun 2017
    Posts
    12
    Articles
    0
    Excel Version
    2013

    VBA: Cut and Paste Not Working



    Register for a FREE account, and/
    or Log in to avoid these ads!

    I have this code that is meant to either copy and paste from Inventory list to Low list, given a certain condition, or cut/paste/delete empty row from inventory list to out of service list. The copy and paste part works, but the cut section isn't pasting to the out of service list. Initially this wasn't an event type and worked fine, but then I tried converting it to an event type and now that section wont't work. I've had to rig a few things, so any help's appreciated.

    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)Dim i, LastRow
    
    
    LastRow = Sheets("Inventory").Range("A" & Rows.Count).End(xlUp).row
    Sheets("Out of Service").Range("A2:I500").ClearContents
    Sheets("Low").Range("A2:I500").ClearContents
    For i = 2 To LastRow
    
    
    If Sheets("Inventory").Cells(i, "E").Value = "0" Then
    Sheets("Inventory").Cells(i, "H").EntireRow.Cut Destination:=Sheets("Out of Service").Range("A" & Rows.Count).End(xlUp).Offset(1)
    Sheets("Inventory").Range("H:H").SpecialCells(xlBlanks).EntireRow.Delete
    End If
    
    
    If Sheets("Inventory").Cells(i, "D").Value < Cells(i, "E") Then
    Sheets("Inventory").Cells(i, "H").EntireRow.Copy Destination:=Sheets("Low").Range("A" & Rows.Count).End(xlUp).Offset(1)
    End If
    
    
    Next i
    End Sub

  2. #2
    Seeker Pahickham's Avatar
    Join Date
    Jun 2017
    Posts
    12
    Articles
    0
    Excel Version
    2013
    Nearly 100 people have viewed this. I know it's gotta be a simple fix. Here's a copy of the excel sheets:

    https://app.box.com/s/167gjv4hw1pa0ayvpvdo98wripxkblli

  3. #3
    Conjurer alansidman's Avatar
    Join Date
    Oct 2018
    Location
    Steamboat Springs
    Posts
    132
    Articles
    0
    Excel Version
    2019
    I don't open files from sites I am not familiar with. Please upload your file directly to this site. Click on Go Advanced and scroll down to Manage Attachments.

  4. #4
    Seeker Pahickham's Avatar
    Join Date
    Jun 2017
    Posts
    12
    Articles
    0
    Excel Version
    2013
    Thanks for the reply! Sorry about the link situation, it's a website just like drop box. Anyways, the current issue I'm having with this sheet is the the "Out of Service" list will cut the desired data out when necessary, but it doesn't paste the numbers on the "Out of Service" sheet. Also when the "Out of Service" code takes place it repeats the inputs in the low column, which shouldn't happen.
    Attached Files Attached Files

  5. #5
    Super Moderator p45cal's Avatar
    Join Date
    Dec 2012
    Posts
    1,523
    Articles
    0
    Excel Version
    365
    Come on Pahickham, you know the rules on cross-posting, supply the links and people will be more inclined to help.

  6. #6
    Magician NoS's Avatar
    Join Date
    Jan 2013
    Location
    British Columbia
    Posts
    756
    Articles
    0
    Excel Version
    Excel 2010 64bit
    Nearly 100 people have viewed this. I know it's gotta be a simple fix.
    Perhaps asking a moderator to move this to the VBA Programming section rather than being in the Formulas section would attract more VBAers.


    I know you haven't acknowledged, but have you looked at the suggestion here ?

  7. #7
    Seeker Pahickham's Avatar
    Join Date
    Jun 2017
    Posts
    12
    Articles
    0
    Excel Version
    2013
    Didn't realize I was in the wrong section that's probably why ha. Also p4 just made the second post today. C'mon cut me some slack!

  8. #8
    Administrator AliGW's Avatar
    Join Date
    Nov 2015
    Location
    Ipswich, Suffolk, England
    Posts
    1,166
    Articles
    0
    Excel Version
    Office 365 Subscription
    You still haven't provided the cross-post links requested. Please do so now.
    Ali
    Enthusiastic self-taught user of MS Excel!

  9. #9
    Super Moderator p45cal's Avatar
    Join Date
    Dec 2012
    Posts
    1,523
    Articles
    0
    Excel Version
    365
    Thread closed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •