Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Insert the Cell Border only the actual printing page

Posted on 2014-07-27
3
Medium Priority
?
163 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

688 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