+ Reply to Thread
Results 1 to 6 of 6

Macro to format cells to make bold and bordered

Hybrid View

nyhiggs22 Macro to format cells to make... 11-16-2012, 04:36 PM
JieJenn Re: Macro to format cells to... 11-16-2012, 04:41 PM
JieJenn Re: Macro to format cells to... 11-16-2012, 04:45 PM
nyhiggs22 Re: Macro to format cells to... 11-16-2012, 04:48 PM
JieJenn Re: Macro to format cells to... 11-16-2012, 04:59 PM
nyhiggs22 Re: Macro to format cells to... 11-16-2012, 05:14 PM
  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    6

    Macro to format cells to make bold and bordered

    Hello All,

    I am trying to create a macro that will run through my sheet of a couple thousand lines and format the text how i want it. Currently this process takes me a couple hours to get a report to look the way it should. Can you please help? Attached is further direction of what i am looking to do. Thank you very much in advance for your help!

    -Chris
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Macro to format cells to make bold and bordered

    Private Sub CommandButton1_Click()
    Dim LR As Long, i As Long
    
    LR = Cells(Rows.Count, 1).End(xlUp).Row
    For i = 1 To LR
        If Cells(i, 2).Font.Bold Then Cells(i, 1).Resize(1, 4).Font.Bold = True
    Next i
    
    End Sub
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Macro to format cells to make bold and bordered

    Oh. I didn't see the borders. Use this instead.

    Private Sub CommandButton1_Click()
    Dim LR As Long, i As Long
    
    LR = Cells(Rows.Count, 1).End(xlUp).Row
    For i = 1 To LR
        If Cells(i, 2).Font.Bold Then
            Cells(i, 1).Resize(1, 4).Font.Bold = True
            Cells(i, 3).Resize(1, 2).Borders(xlEdgeTop).Weight = xlThin
        End If
    Next i
    
        Cells(LR, 3).Resize(1, 2).Borders(xlEdgeBottom).LineStyle = xlDouble
    End Sub

  4. #4
    Registered User
    Join Date
    10-11-2012
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Macro to format cells to make bold and bordered

    when i put this code into the workbook, it doesn't come up in my macro viewer

  5. #5
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Macro to format cells to make bold and bordered

    insert a new module with a new sub name and insert

    Dim LR As Long, i As Long
    
    LR = Cells(Rows.Count, 1).End(xlUp).Row
    For i = 1 To LR
        If Cells(i, 2).Font.Bold Then
            Cells(i, 1).Resize(1, 4).Font.Bold = True
            Cells(i, 3).Resize(1, 2).Borders(xlEdgeTop).Weight = xlThin
        End If
    Next i
    
        Cells(LR, 3).Resize(1, 2).Borders(xlEdgeBottom).LineStyle = xlDouble

  6. #6
    Registered User
    Join Date
    10-11-2012
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Macro to format cells to make bold and bordered

    AMAZING!!!! Any way to make the double line border into the border style of single top line and double bottom line?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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