I am attempting to search through a dynamic column which may have x number of blank cells and y number of cells with dates. I want to search the column for the first blank cell, then copy the cell immediately above it and paste it on a new sheet, I also want to copy the cell immediately below the blank cell and paste that on a different column in that new sheet. I want to repeat this so that I have a column of all cells above the blank cells from the original sheet in the new sheet and a separate column for all cells below in the new sheet.
this is my code which does not work fully, and also takes and copy's a different cell in the last column, which I need to do as well.
"Dim lRealLastRow As Long
Dim lRealLastColumn As Long
Dim i As Integer
Dim intRowCount As Integer
intRowCount = Sheets("Damages").Range("P1")
For i = 1 To intRowCount
Range("A1").Select
On Error Resume Next
lRealLastRow = Cells.Find("*", Range("A1"), xlFormulas, , xlByRows, xlPrevious).Row
lRealLastColumn = Cells.Find("*", Range("A1"), xlFormulas, , xlByColumns, xlPrevious).Column
Cells(lRealLastRow, lRealLastColumn).Select
Selection.copy
Sheets("Temp Data").Select
Sheets("Temp Data").Range("D1").Select
Range(D1).Select
Range("D1").End(xlDown).Select
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Select
End If
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Review").Select
ActiveCell.Offset(1, -4).Select
Next i
End Sub"
this is my code which does not work fully, and also takes and copy's a different cell in the last column, which I need to do as well.
"Dim lRealLastRow As Long
Dim lRealLastColumn As Long
Dim i As Integer
Dim intRowCount As Integer
intRowCount = Sheets("Damages").Range("P1")
For i = 1 To intRowCount
Range("A1").Select
On Error Resume Next
lRealLastRow = Cells.Find("*", Range("A1"), xlFormulas, , xlByRows, xlPrevious).Row
lRealLastColumn = Cells.Find("*", Range("A1"), xlFormulas, , xlByColumns, xlPrevious).Column
Cells(lRealLastRow, lRealLastColumn).Select
Selection.copy
Sheets("Temp Data").Select
Sheets("Temp Data").Range("D1").Select
Range(D1).Select
Range("D1").End(xlDown).Select
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Select
End If
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Review").Select
ActiveCell.Offset(1, -4).Select
Next i
End Sub"