Hi all, I have found a simpler roundabout solution. Basically, I created a second sheet where the database should be. Sheet 1 would be where Ron de Bruin's code is run, and then I would use VBA to copy and paste the relevant rows and columns into the next empty cell in Sheet 2. My code is as such:
Sub copy()
Thanks all for your kind help!'copy Worksheets("Sheet1").Activate If IsEmpty(Range("A1").Value) = False Then Range("B3").Select Range(ActiveCell, ActiveCell.End(xlToRight).End(xlDown)).Select Selection.copy 'paste 'empty Worksheets("All").Activate If IsEmpty(Range("A1").Value) = True Then Range("A1").PasteSpecial Range("A1").PasteSpecial xlPasteColumnWidths End If 'not empty If IsEmpty(Range("A1").Value) = False Then Range("A1").End(xlDown).Offset(1, 0).PasteSpecial xlPasteColumnWidths Range("A1").End(xlDown).Offset(1, 0).PasteSpecial End If Worksheets("Sheet1").Cells.Clear End If If IsEmpty(Range("A1").Value) = True Then MsgBox ("No Data") End If End Sub




Reply With Quote