Solved

How to Insert the Cell Border only the actual printing page

Posted on 2014-07-27
3
159 Views
Last Modified: 2014-07-31
I have an excel sheet  named " Sheet 1"  an have  data in  Column A to N . The data are Placed from  Row  10  to any row depends on the quantity of data .
I like to know the VBA code  to insert the border only to the page that are actually filled with data . so it mean that for instance i have only one row of data , so i will have only 1 page , that entire  page ( column A to N ) should have the Border on each cell ( from  A10 : N10  to down the end of same page ) if instead i have more data that will fill more than 1 page , i will have the border down to the last entire  page containing data . Thanks
0
Comment
Question by:sanlorenzo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 40222466
You can check the pagebreak property.
Option Explicit

Sub FindPageBreak()
    Dim r As Integer
    Dim iCount
    r = 1
    Do While Rows(r).PageBreak = xlPageBreakNone
        If Rows(r).PageBreak <> xlPageBreakNone Then
            iCount = iCount + 1
            If iCount = 1 Then
                MsgBox "Row " & r & " is the start of this page"
            End If
        End If
        r = r + 1
    Loop
    MsgBox "Row " & r & " is at the top of a new page"
End Sub

Open in new window

0
 

Author Comment

by:sanlorenzo
ID: 40222668
Hi sir , i see you placed the code to pop up a message , however i do not need a message , i need the border in the cell of the page ( pages ) that contains  data . Thanks
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 40222918
I have demonstrated the method for you to fit in with your existing code.

If you are able to use and comprehend VBA code, as your question suggests, then you should be able to incorporate this extra code into your existing code.

If not, then, you should be aware  that this is a how-to site, as opposed to a do-it-for-you site. I interpret that as meaning that if you claim to to use VBA, then your need is to know how the job is done in VBA.

If you are already using VBA, and don't understand your existing code, then I urge you to study, step-by-step, the purpose and outcome of each step.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
allswap challenge 6 152
vb6 - Transfer from MSHFlexgrid1 to xls issue 8 66
Macro Excel - Multiple If conditions 2 94
Modify Text File with Excel Macro 13 51
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
The viewer will learn how to implement Singleton Design Pattern in Java.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question