• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Data are not one below the other

marreco

Member
Hi

Way happening it..?
My code get values other sheet, but get formulas and paste value.
Afte this, some cells are empty, but the next data pasted, it is not below the other data.
Try execute my code multiple times.
Code:
Sub strange_empty_cells()
    Application.ScreenUpdating = 0
        Worksheets("Dados").Range("X2:AA11").Copy
        Worksheets("Indice").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
        Application.CutCopyMode = False
    Application.ScreenUpdating = 1
End Sub

Thank you!!
 

Attachments

  • StrangeCellsBlank.xlsx
    80.4 KB · Views: 2
Hello Marreco,

Try This....
Code:
Sub strange_empty_cells()
    Application.ScreenUpdating = 0
    Dim MyRange As Excel.Range, Cell, Addss As String
    Set MyRange = Worksheets("Dados").Range("X2:X11")
   
    For Each Cell In MyRange
        If Len(Cell) >= 1 And Cell.Value <> "" Then
        Addss = Cell.Address
        Worksheets("Dados").Range(Addss, Worksheets("Dados").Range(Addss).Offset(, 3)).Copy
        Worksheets("Indice").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
        Application.CutCopyMode = False
       
        End If
       
    Next Cell
    Application.ScreenUpdating = 1
End Sub
 
Hi ,

Try this :
Code:
Sub no_more_empty_cells()
    Application.ScreenUpdating = 0
    lastrow = Application.Match("", Worksheets("Dados").Range("X:X"), 0) - 1
    Set Rng = Worksheets("Dados").Range("X2:AA" & lastrow)
    Rng.Copy
    Worksheets("Indice").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
    Application.CutCopyMode = False
    Application.ScreenUpdating = 1
End Sub
 
Back
Top