TkdKidSnake
Board Regular
- Joined
- Nov 27, 2012
- Messages
- 245
- Office Version
- 365
- Platform
- Windows
Hello all,
I wonder if you would be able to help I am trying to format several sheets in a workbook however lets just say that I am using the active worksheet. I want to achieve this using VBA code.
1) Adding horizontal border lines
a) I need to put a horizontal line between every odd line (Bottom) and even line (Top) starting from R11 & R12
This line is also from A to AI
b) This needs to happen every time the data changes in even cells starting from R10 going down also the worksheet can vary in length (e.g. R10, R12, R14, R16 etc etc)
I.e. If the data is the same in R10 as in R12 no border line is inserted between Row 11 & Row 12 and then if it changes in R14 then
The border line is inserted between Row 13 & Row 14
2) Organising page breaks
a) need to ascertain how many pages is in the worksheet, taking into consideration each page is 39 lines long
b) as in item 1 if the data is the same and this goes over a page break the break needs to move up until the data changes
I.e. If the data is the same in R40 as in R38 but changes in R36 the break needs moving between rows 37 and 38
c) The data for each product is also over two lines so if the break appears 38 & 39 and splits the data it should also move it up one taking in account 1b
If anyone can help with this it would be most appreciated as I am really struggling with this
Thank you all.
I wonder if you would be able to help I am trying to format several sheets in a workbook however lets just say that I am using the active worksheet. I want to achieve this using VBA code.
1) Adding horizontal border lines
a) I need to put a horizontal line between every odd line (Bottom) and even line (Top) starting from R11 & R12
This line is also from A to AI
b) This needs to happen every time the data changes in even cells starting from R10 going down also the worksheet can vary in length (e.g. R10, R12, R14, R16 etc etc)
I.e. If the data is the same in R10 as in R12 no border line is inserted between Row 11 & Row 12 and then if it changes in R14 then
The border line is inserted between Row 13 & Row 14
2) Organising page breaks
a) need to ascertain how many pages is in the worksheet, taking into consideration each page is 39 lines long
b) as in item 1 if the data is the same and this goes over a page break the break needs to move up until the data changes
I.e. If the data is the same in R40 as in R38 but changes in R36 the break needs moving between rows 37 and 38
c) The data for each product is also over two lines so if the break appears 38 & 39 and splits the data it should also move it up one taking in account 1b
If anyone can help with this it would be most appreciated as I am really struggling with this
Thank you all.