Jump to content

excel macro - copy/paste without excess rows


CompeteWithPete

Recommended Posts

so i have one tab with data with all my data.

 

i have another tab with a macro mining filtered fields.

 

i only want 6 columns in the end of the 30 original columns to paste over.

 

in doing so it pastes each column with running rows into millions when there should only be for example 10 rows of data per column.

 

any ideas how to set range with values indtead of creating a million rows of blanks space?

Link to comment
Share on other sites

You should be able to just copy visible rows, if I understand roughly what you're trying to do. If you have an example workbook or some code I can look at it, though might not be until later on in the weekend as I'm commuting across the country at the moment.

Link to comment
Share on other sites

If i understand you correctly you are moving the data from one worksheet to another using a VBA macro. And the VBA macro will copy the cells from one worksheet to another for selected column you want to move over, and you are copying and pasting blank rows into the other sheet?

 

If so you have two options.

 

One create a dynamic named range and reference those in your code.

 

Or two when looping through the cells in the range if the value of the cell is equal to an empty string simply break out of the loop.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...