kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
My table is like this:
Range(“A3:J” & lr)
Where lr is the last used row in column B
So, column B contain names which has associated categories in column C.
At the end of each category in column C, there is a “SUB-TOTAL” string in column B.
Now here is what I want to do:
When I get to a “SUB-TOTAL” string in column B, I want to have three (3) blank rows inserted below the “SUB-TOTAL” string.
Then after that I want to copy the contents of the range A1:J2 and paste it at the second and third rows of the the blank rows I have just inserted(that is to create a header for the next category)
*****The first blank row is there to separate one category from another******
Then I repeat the copy and pasting of A1:J2 for each SUB-TOTAL that I come across in the column B.
FYI:
The Range A1:J1 is merged.
I also want to apply the row heights of the source to the destination.
I am using this approach because I want to have multiple categories on a sheet when I print out and still have my headers for each category.
Can someone please help me out with the code for that?
Thanks in advance.
Range(“A3:J” & lr)
Where lr is the last used row in column B
So, column B contain names which has associated categories in column C.
At the end of each category in column C, there is a “SUB-TOTAL” string in column B.
Now here is what I want to do:
When I get to a “SUB-TOTAL” string in column B, I want to have three (3) blank rows inserted below the “SUB-TOTAL” string.
Then after that I want to copy the contents of the range A1:J2 and paste it at the second and third rows of the the blank rows I have just inserted(that is to create a header for the next category)
*****The first blank row is there to separate one category from another******
Then I repeat the copy and pasting of A1:J2 for each SUB-TOTAL that I come across in the column B.
FYI:
The Range A1:J1 is merged.
I also want to apply the row heights of the source to the destination.
I am using this approach because I want to have multiple categories on a sheet when I print out and still have my headers for each category.
Can someone please help me out with the code for that?
Thanks in advance.