0

I have tested my macro many times through VBA Run Window, and all on Sheet2 appears correctly. When I try to run Macro from Button on Sheet1, two columns "C" and "D" raise all the numbers by one cell up. What could be the issue on Button, Sheet1?

At the same time, this script code has been arranged to delete content from empty rows with additional words, or letters, then it is suppose to delete a row up, perhaps, this could be the issue.

My code:

Sub CopyPasteintoSheet2()


Dim lr As Long
Dim i As Long
Dim inputdtae As Date
Dim rng As Range


lr = Cells(Rows.Count, 1).End(xlUp).Row

    For i = lr - 0 To 2 Step -1
        If Cells(i, "B") = "LLC" Then
            Cells(i, "B").EntireRow.Delete
        End If
    Next i


ActiveWindow.SmallScroll Down:=11

    Columns("J:J").Select
    Selection.TextToColumns Destination:=Range("J1"), DataType:=xlDelimited, _
    TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
    Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
    :=Array(1, 1), TrailingMinusNumbers:=True
    Columns("R:R").Select
    Selection.TextToColumns Destination:=Range("R1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 1), TrailingMinusNumbers:=True



Dim LastRow As Long
Dim NEWFORMAT As Worksheet
Dim Results As Worksheet

   Set Results = Sheets("NEWFORMAT")
    LastRow = Results.Cells(Results.Rows.Count, "Z").End(xlUp).Row

    Range("A15:A400").Copy
    Results.Range("A" & LastRow + 2).PasteSpecial xlValues
    Range("B15:B400").Copy
    Results.Range("B" & LastRow + 2).PasteSpecial xlValues
    Range("J15:J400").Copy
    Results.Range("C" & LastRow + 2).PasteSpecial xlValues
    Range("R15:R400").Copy
    Results.Range("D" & LastRow + 2).PasteSpecial xlValues

    Application.DataEntryMode = False

End Sub
Unicode
  • 11
  • 6

0 Answers0