Jump to content


Photo

excel macro - copy/paste without excess rows


  • Please log in to reply
3 replies to this topic

#1 CompeteWithPete

CompeteWithPete
  • Elite Member
  • 659 posts

Posted 07 December 2017 - 09:41 PM

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?
kick lyrics like shoes, right in ya face

#2 Deft

Deft

    DOS Commander

  • Elite Member
  • 2,545 posts

Posted 08 December 2017 - 02:08 PM

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.

Real DJs use SL1200GAEs


#3 Tbtf

Tbtf

    Charlie

  • Elite Member
  • 274 posts

Posted 11 December 2017 - 08:51 PM

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.


all-fanart.jpg

 


#4 Jam Burglar

Jam Burglar
  • Elite Member
  • 825 posts

Posted 12 December 2017 - 11:55 AM

Damn son, I need to up my excel game.


  • broke likes this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users