Results 1 to 4 of 4

Change code to ActiveSheet

Threaded View

rajeshn_in Change code to ActiveSheet 03-29-2018, 05:39 AM
Norie Re: Change code to ActiveSheet 03-29-2018, 05:43 AM
rajeshn_in Re: Change code to ActiveSheet 03-29-2018, 05:48 AM
rajeshn_in Re: Change code to ActiveSheet 03-29-2018, 06:04 AM
  1. #1
    Forum Contributor
    Join Date
    04-06-2016
    Location
    Singapore
    MS-Off Ver
    MS Office 365 & 2010
    Posts
    701

    Change code to ActiveSheet

    Hi friends,

    I got a code from http://www.vbaexpress.com/forum/arch...p/t-13260.html website

    this code applying for all sheets in a workbook. I want to apply only active worksheet. Please change code as Active Sheet mode

    And Line going to across sheet. Can we control that line in a range, like I have a data in Range A1:K114, So will come A to K column only.

    Sub BottomLine()
    Dim ws As Worksheet
    Dim pb As HPageBreak
    Dim LastRow As Long
    
    
    For Each ws In ThisWorkbook.Worksheets
    ActiveWindow.View = xlPageBreakPreview
    
    For Each pb In ws.HPageBreaks
    LastRow = pb.Location.Offset(-1, 0).Row
    Firstrow = pb.Location.Offset(0, 0).Row
    
    With ws.Rows(LastRow).Borders(xlEdgeBottom)
    .LineStyle = xlContinuous
    .Weight = xlThin
    End With
    
    With ws.Rows(Firstrow).Borders(xlEdgeTop)
    .LineStyle = xlContinuous
    .Weight = xlThin
    End With
    
    Next pb
    Next ws
    
    End Sub
    Last edited by rajeshn_in; 03-29-2018 at 05:42 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Activesheet Reference for every line of code
    By skellz022782 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-06-2016, 11:56 AM
  2. [SOLVED] Code failing on ActiveSheet.Paste
    By amartin575 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-29-2015, 01:57 PM
  3. ActiveSheet.PivotTables => How to do it for custom sheet? (replace ActiveSheet)
    By chrisignm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2014, 03:22 PM
  4. How to change current syntax to have ActiveSheet.Previous.Select
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2012, 10:38 AM
  5. ActiveSheet Range Formula Change
    By aftabn10 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2011, 08:42 AM
  6. ActiveSheet change form VB.NET
    By mqdias in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-20-2007, 05:04 AM
  7. Change UserForm Depending on ActiveSheet?
    By jonn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-12-2007, 09:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1