ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Empty range of cells (https://www.excelbanter.com/excel-programming/390459-empty-range-cells.html)

anamarie30

Empty range of cells
 
My sheet1 have a list of things in two ranges (A11:A50, C11:C50) and some
of the cells are empty. I need to copy the list from the two ranges to, for
example, in A1:A100 on sheet2 without the empty cells.

Jim Thomlinson

Empty range of cells
 
This should be close...

Sub MoveStuff()
With Sheets("Sheet2")
.Range("A1:A40").Value = Sheets("Sheet1").Range("A11:A50").Value
.Range("A41:A80").Value = Sheets("Sheet1").Range("C11:C50").Value
On Error Resume Next
.Range("A1:A80").SpecialCells(xlCellTypeBlanks).De lete xlShiftUp
On Error GoTo 0
End With
End Sub
--
HTH...

Jim Thomlinson


"anamarie30" wrote:

My sheet1 have a list of things in two ranges (A11:A50, C11:C50) and some
of the cells are empty. I need to copy the list from the two ranges to, for
example, in A1:A100 on sheet2 without the empty cells.



All times are GMT +1. The time now is 06:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com