Good evening all,
I need VBA to select Cells B3:G3 down to the last cell with data and then have it copy and paste to another work sheet,
How would I be best going about this?
Regards
N3
Good evening all,
I need VBA to select Cells B3:G3 down to the last cell with data and then have it copy and paste to another work sheet,
How would I be best going about this?
Regards
N3
Last edited by N3CREN; 09-20-2018 at 03:17 PM.
If you are working with static ranges/cells (e.g. always pasting to the same cell(s) on the second worksheet) then something simple should suffice...
![]()
Please Login or Register to view this content.
Hey thanks for the quick response,
The cells that I need to copy from B3:G3 always go to "sheet 1" however needs to go to the next available blank cell, I have set up a seperate VBA script that goes to the next blank cell on the sheet but not sure how I would tie it into that code above
![]()
Please Login or Register to view this content.
title updated......
Last edited by protonLeah; 09-20-2018 at 05:29 PM.
Ben Van Johnson
Try this instead. It calculates the last row of data in the source sheet (change name as needed), as well as the next available row in the destination sheet (RP_DATA).
![]()
Please Login or Register to view this content.
That works brilliantly,
However the only issue i'm having now is a similar sheet only I copy A2:B2 (and all cells with data below) and paste into another sheet same scenario as before columns A:B next row. I've tried reusing the above but it works with the invcut but then not this one
Not sure what "invcut" is, but you may need to get the lastrow value from column A instead of column B in this case? (And set the copy range to "A2:B" & lastrow)
![]()
Please Login or Register to view this content.
So my only issue now is that the above doesn't work if you don't use Refresh all in the data tab before running the macro.
Even though I have VBA Do a refresh all before calling upon each macro
How do I solve this
![]()
Please Login or Register to view this content.
**Solved the issue**
Last edited by N3CREN; 09-21-2018 at 02:05 PM.
If you wouldn't mind, please post how you solved your issue - to the benefit of others who might read this post in the future.
Good idea! although it was pretty simple,
I added a doevents under the refresh all command and also set the background refresh to off in queries.
No matter what I tried before this the copying of the Query from my Transform and get would only work if it was refreshed before running the macro
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks