Insert Border Lines And Then Adjust Page Breaks - Using VBA Coding

TkdKidSnake

Board Regular
Joined
Nov 27, 2012
Messages
245
Office Version
  1. 365
Platform
  1. 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.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,213,565
Messages
6,114,338
Members
448,569
Latest member
Honeymonster123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top