I have a worksheet with three columns that has over 1000 rows. What I want
to do is copy a specific range to another workbook, but to exclude any rows
that might be blank.
Thanks
Mary
I have a worksheet with three columns that has over 1000 rows. What I want
to do is copy a specific range to another workbook, but to exclude any rows
that might be blank.
Thanks
Mary
assuming no rows have blanks apart from those to delete then
Option Explicit
Sub test()
CopyRows Selection, Sheet2.Range("B2")
End Sub
Sub CopyRows(source As Range, target As Range)
With target.Resize(source.Rows.Count, source.Columns.Count)
.Value = source.Value
.SpecialCells(xlCellTypeBlanks).Delete
End With
End Sub
sheet2 is an empty sheet
select your range i=on sheet1 and run the code
you can easily adapt the test procedure for specific ranges
example
CopyRows Sheet1.Range("MyData"), Sheet2.Range("B2")
"Mary" wrote:
> I have a worksheet with three columns that has over 1000 rows. What I want
> to do is copy a specific range to another workbook, but to exclude any rows
> that might be blank.
>
> Thanks
> Mary
>
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks