• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

only Copy range of cells using command button

sandane

New Member
Hi chandoo, i have created a excel macro that will copy a particular range of cells when clicking a button. its copying the selected whole area. but i m looking in that selected area, it has to copy only data not blank space. (Eg. in selected range of cells is ten rows and the data was only two rows. it has select only two rows not ten rows means not blank rows). Please help me out.
 

Hui

Excel Ninja
Staff member
Sandane


Welcome to the Chandoo.org forums


Can you post your code please
 

jhargram

New Member
Hi Sandane,

You call this in command button


First you need to put the range

like:

Sub copy()

Range("cell number").selection //this is the first cell of the data//

Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select

Selection.copy

End Sub


I think it will help..
 

vasim

Member
Here you go!


Sub Copy()

Range("A1").Select

Range(Selection, Selection.End(xlDown)).Select

Selection.Copy


End Sub
 
Top