+ Reply to Thread
Results 1 to 2 of 2

Not Copying Borders of range

Hybrid View

  1. #1
    Registered User
    Join Date
    06-24-2015
    Location
    Oklahoma City
    MS-Off Ver
    2016
    Posts
    28

    Not Copying Borders of range

    Hi, I have a macro that builds a grid to use as a map, my sheet starts with a 36 cell range from B2:G7 that is already filled out and formatted correctly. Each cell has a thin border, and there is a thick border that encloses all 36 together. To build the map my code copies the range from B2:G7 and offsets it. Everything works as it should except I lose the thick border around my range. Does anyone know how I can modify my code so that the thick border will be copied and pasted as well?
    Dim NR As Double
    Dim ND As Double
    Dim NRV As Double
    NRV = 1
    Dim NDV As Double
    NDV = 1
    Dim Sections As Range
    Set Sections = Sheets("Map").Range("b2:g7")
    Sections.Copy
    Do Until NRV = NR
    Sections.Offset(0, NRV * 6).PasteSpecial xlPasteAll
    NRV = NRV + 1
    Loop
    
    Dim sv As Range
    With ActiveSheet.UsedRange
    Set sv = .Offset(1, 0).Resize(.Rows.Count - 1)
    End With
    sv.Copy
    
    
    Do Until NDV = ND
    sv.Offset(NDV * 6, 0).PasteSpecial xlPasteAll
    NDV = NDV + 1
    Loop
    NR and ND are variable that are given values through a lot of calculation that i omitted from this posting

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Not Copying Borders of range

    Maybe:

    Do Until NDV = ND
    sv.Offset(NDV * 6, 0).PasteSpecial xlPasteAll
    sv.Offset(NDV * 6, 0).PasteSpecial xlPasteFormats
    NDV = NDV + 1
    Loop
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

+ 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. Borders with dynamic range
    By Rob K in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2015, 08:14 AM
  2. [SOLVED] Borders around all cells in a range
    By JonSnow in forum Excel General
    Replies: 5
    Last Post: 11-26-2013, 10:21 AM
  3. Replies: 9
    Last Post: 04-17-2013, 08:57 AM
  4. [SOLVED] Use of Range and Last row to add borders around cells.
    By BBoydAnchor in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2012, 01:38 AM
  5. The borders of the selected range
    By dboyko in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-23-2007, 04:56 AM
  6. [SOLVED] Remove all borders from a range
    By quartz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2005, 10:05 PM
  7. [SOLVED] How do I secure borders, make them unaffected by copying or draggi
    By sebds70 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-21-2005, 09:06 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