Copy a range of cells and only select cells with data

前端 未结 3 1797
暗喜
暗喜 2020-12-11 06:57

I\'m looking for a way to copy a range of cells, but to only copy the cells that contain a value.

In my excel sheet I have data running from A1-A18, B is empty and C

3条回答
  •  孤城傲影
    2020-12-11 07:47

    To improve upon Jean-Francois Corbett's answer, use .UsedRange.Rows.Count to get the last used row. This will give you a fairly accurate range and it will not stop at the first blank cell.

    Here is a link to an excellent example with commented notes for beginners...

    • Excel macro - paste only non empty cells from one sheet to another - Stack Overflow

提交回复
热议问题