Solved

How to Insert the Cell Border only the actual printing page

Posted on 2014-07-27
3
153 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
  • 2
3 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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 …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now