Can the code below be made shorter?
I mean, instead of the repeating "copy/paste", is there another shorter way?
![]()
Please Login or Register to view this content.
Can the code below be made shorter?
I mean, instead of the repeating "copy/paste", is there another shorter way?
![]()
Please Login or Register to view this content.
Hi,
You could use a separate routine for the copy and paste
and then the code you posted would become![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
Don
Please remember to mark your thread 'Solved' when appropriate.
So in essence, when I execute macro "test", it would call the subroutine "CopyPasteValueAndFormat"?![]()
Please Login or Register to view this content.
And both can be in the same module?
Yes, that's correct.
Ok. Got it. Thanks!
And, I suppose, if I do this many times, I can set up several subroutines (CopyPasteValueAndFormat1, CopyPasteValueAndFormat2, etc) and specify in my macro which one to use.
Yes you can. You may even be able to have one routine but use a few more parameters (e.g. the sheet to copy to) to make it more generic.
Do the columns all have the same number of rows of data? If so, you could just determine the last row once and use that.
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
Not sure what you are asking but we are taking a total of 7 cells here and there and paste them in last row of columns 28 through 34.
And yes, the last empty row for any column in 28-34 is the last row for all of them. In other words, the pasted data will be in one row.
Just for fun:
![]()
Please Login or Register to view this content.
Less distracting:
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks