+ Reply to Thread
Results 1 to 2 of 2

Need to border to bottom of range

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-26-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    133

    Need to border to bottom of range

    I would like to a add a Thin border to bottom of the last row with data in Sub Test3. Then when I click the command button to send the data i want the border to go with the data to sheet Shop. Thanks for any help.

    Option Explicit
    
    Sub Tops()
    Dim a, LR&
     With Sheets("Tops")
        a = Array(.Range("E18"), .Range("E17"), .Range("E21"), .Range("AQ28"), .Range("E14"), _
            .Range("AQ29"), .Range("AQ30"))
           With Sheets("CTop List")
             LR = .Cells.Find("*", , , , xlByRows, xlPrevious).Row + 1
                 .Range("A" & LR).Resize(, UBound(a) + 1) = a
                      With .UsedRange
                       .Value = .Value
                       .Columns.AutoFit
                      End With
           End With
           Call Test1
           Call Test2
           Call Test3
    
        .Range("E18,E21").ClearContents
     End With
    
    End Sub
    Sub Test1()
    Application.ScreenUpdating = 0
        Dim result, n&, i&, ar As Variant, j&
    
          With Sheets("Tops")
            ar = .Range("G12:P" & .Cells.Find("*", , , , xlByRows, xlPrevious).Row)
          End With
        
          ReDim result(1 To UBound(ar), 1 To UBound(ar, 2))
          
          For i = 1 To UBound(ar, 1)
          
             If ar(i, 3) > 0 And ar(i, 3) <> "Copies" Then
                 n = n + 1
                 For j = 1 To UBound(ar, 2)
                    result(n, j) = ar(i, j)
                 Next
             End If
          Next i
         
           With Worksheets("Wood Parts")
             If n > 0 Then .Range("A" & .Rows.Count).End(xlUp).Offset(1).Resize(n, UBound(ar, 2)) = result
           End With
        
        Application.ScreenUpdating = True
    End Sub
    Sub Test2()
    Application.ScreenUpdating = 0
        Dim result, n&, i&, ar As Variant, j&
    
    
          With Sheets("Tops")
            ar = .Range("R12:AA" & .Cells.Find("*", , , , xlByRows, xlPrevious).Row)
          End With
        
          ReDim result(1 To UBound(ar), 1 To UBound(ar, 2))
          
          For i = 1 To UBound(ar, 1)
          
             If ar(i, 3) > 0 And ar(i, 3) <> "Copies" Then
                 n = n + 1
                 For j = 1 To UBound(ar, 2)
                    result(n, j) = ar(i, j)
                 Next
             End If
          Next i
         
           With Worksheets("Plam Parts")
             If n > 0 Then .Range("A" & .Rows.Count).End(xlUp).Offset(1).Resize(n, UBound(ar, 2)) = result
           End With
        
        Application.ScreenUpdating = True
    End Sub
    Sub Test3()
    
    Application.ScreenUpdating = 0
        Dim result, n&, i&, ar As Variant, j&
    
          With Sheets("Tops")
            ar = .Range("AN12:AU" & .Cells.Find("*", , , , xlByRows, xlPrevious).Row)
          End With
        
          ReDim result(1 To UBound(ar), 1 To UBound(ar, 2))
          
          For i = 1 To UBound(ar, 1)
          
             If ar(i, 1) > 0 And ar(i, 3) <> "Ctop#" Then
                 n = n + 1
                 For j = 1 To UBound(ar, 2)
                    result(n, j) = ar(i, j)
                 Next
             End If
          Next i
         
           With Worksheets("Shop")
             If n > 0 Then .Range("A" & .Rows.Count).End(xlUp).Offset(1).Resize(n, UBound(ar, 2)) = result
           End With
            
        Application.ScreenUpdating = True
        
    End Sub

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,998

    Re: Need to border to bottom of range

    I think you'll have to apply the bottom border after you have copied the array back into the worksheet.

    Provide a sample workbook if you want a tested solution.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Draw bottom border on every rows from top to bottom
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-08-2013, 09:52 AM
  2. [SOLVED] bottom border on a range of cells using a variable for the row value
    By jlawson258 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2012, 12:45 PM
  3. Loop that adds thick bottom border to row range
    By msmick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2012, 11:43 PM
  4. Shared Top and Bottom Border - Bottom not printing
    By bick421 in forum Excel General
    Replies: 0
    Last Post: 01-07-2009, 03:47 PM
  5. bottom border every second cell in range
    By cass calculator in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2006, 12:50 PM

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