Using a macro how do I copy a range of cells, with formulas, from one range to the next range/column? Then copy the new range of cells to the next column when the macro is run again?
Using a macro how do I copy a range of cells, with formulas, from one range to the next range/column? Then copy the new range of cells to the next column when the macro is run again?
Please provide some more details like -
1. Are the ranges in the same workbook?
2. If in the same workbook, are they in the same worksheet or different worksheets?
3. What are the cell addresses of the ranges?
If I have helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Something like this?
Please Login or Register to view this content.
Did you try the code Rob gave you?
Hi...
Yeah I tried what Rob said, it works but it copies the entire column. I want to copy a range eg B1:B10 to C1:C10...then when I run it the next time it must copy from C1:C10 to D1:D10...
Seems to me that:
Would sufficePlease Login or Register to view this content.
Thank you for all the help. I am almost where i need to be. Just a few more questions now that the main bit is sorted.
Using the same or another macro I now I need to find out how to copy and paste special the previous range
and is it possible for then use Kyle123's macro on multiple worksheets?
Mine will work on the active sheet, so yes, it does that by default.
My method won't work for paste special though. What is it you are needing? Just the values? If so
Please Login or Register to view this content.
Thanks Kyle. Let me see if I can explain a bit better what I require..
Ok I have formulas in 17 worksheets in the same place eg B12:B22. When I run the macro I want it to copy that formula to C12:22, then copy and paste special values in B12:B22. The next time I run the macro it must now copy the formulas for C12:C22 to D12:D22, then copy and paste special values in C12:C22 and so on
Maybe:
Or if you want the ranges in the formulas to increment:Please Login or Register to view this content.
Please Login or Register to view this content.
Last edited by Kyle123; 06-15-2012 at 05:38 AM.
Thank u kyle this works, but ..
where u have "ActiveSheet.Columns.Count" is there a way to change this so that it simulantenously does, "sheet1, sheet2 , sheet 3 etc" whilst using the same range?
Also where you have "Resize(10)" say for example I have 10 rows, which pulls through fine, then there is 2 empty rows and then another 2-3rows that I need brought over so example: "A1:A10 and then A13:A16"
where u have "ActiveSheet.Columns.Count" is there a way to change this so that it simulantenously does, "sheet1, sheet2 , sheet 3 etc" whilst using the same range?
Also where you have "Resize(10)" say for example I have 10 rows, which pulls through fine, then there is 2 empty rows and then another 2-3rows that I need brought over so example: "A1:A10 and then A13:A16"
Potentially:
Please Login or Register to view this content.
What error do you get? At a guess you have no data in one of your worksheets
there is no specific error it just highlights that line in yellow?
It must say something?
Do you think its at all possible for me to get your email address as it wont let me paste a screen dump here? maybe i can mail you the situation I am getting?
Run-time error '1004':
Application-defined or object -defined error
Try This:
Please Login or Register to view this content.
Great thank you, it works!! whew!
Is there a way though that this may only run for specific sheets, so I have 17 worksheets, I only require this to run for sheet1 , sheet 2 and sheet 3?
Like this:
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks