Closed Thread
Results 1 to 5 of 5

custom borders icon to use on the tool bar

Hybrid View

Guest custom borders icon to use on... 02-03-2005, 03:06 PM
swatsp0p First, open the VBA editor... 02-03-2005, 05:00 PM
Guest Re: custom borders icon to... 02-03-2005, 07:06 PM
Guest Re: custom borders icon to... 02-10-2005, 04:06 PM
Guest Re: custom borders icon to... 02-10-2005, 05:06 PM
  1. #1
    robin
    Guest

    custom borders icon to use on the tool bar

    I want to make a custome borders icon to use on the tool bar. I need a
    double line at the top and a single line at the bottom. PLease help, Robin

  2. #2
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    First, open the VBA editor (ALT+F11) and create a new module in your VBA project (select your workbook's name in the left pane and click Insert>Module on the menu). Double click the module to open it in the right pane. Paste this code in the new module:


    Sub borders()
    '
    ' borders Macro
    ' Selection.borders(xlDiagonalDown).LineStyle = xlNone
    Selection.borders(xlDiagonalUp).LineStyle = xlNone
    Selection.borders(xlEdgeLeft).LineStyle = xlNone
    With Selection.borders(xlEdgeTop)
    .LineStyle = xlDouble
    .Weight = xlThick
    .ColorIndex = xlAutomatic
    End With
    With Selection.borders(xlEdgeBottom)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    Selection.borders(xlEdgeRight).LineStyle = xlNone
    End Sub

    Exit the VBA editor (ALT-Q)

    To create a new icon for a toolbar button, right click anywhere on any toolbar and select "Customize..."

    On the "Commands" tab, select Tools in the left pane and scroll in the right pane to an icon named Custom. Drag this icon to your desired location on your toolbar.

    Right click on this new icon and select either "Edit button image" or "Select button image" and create the look you want.

    Then, right click on your new design and select "Assign Macro..." and select "borders" from the list of available macros and click OK.

    Finally, click "Close" on the Customize box. Select your desired cell and click your new tool bar button. Remember, the top border of one cell is the same as the bottom border of the cell above it.

    Good Luck
    Bruce
    The older I get, the better I used to be.
    USA

  3. #3
    Gord Dibben
    Guest

    Re: custom borders icon to use on the tool bar

    robin

    This is the code I got when I recorded a macro while formatting as you
    describe.

    Copy/paste to a general module in your workbook. For instructions on creating
    a general module see below.

    Assign it to a button on your Toolbar.

    Sub Macro2()
    With Selection.Borders(xlEdgeTop)
    .LineStyle = xlDouble
    .Weight = xlThick
    .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    End Sub

    To get a button to the Toolbar you can.........

    Tools>Customize>Commands>Macros.

    Drag the smiley-face to the Toolbar.

    Right-click on it a Assign Macro and also "Change Button Image" if you wish.

    OK your way out.

    If not familiar with VBA and macros, see David McRitchie's site for more on
    "getting started".

    http://www.mvps.org/dmcritchie/excel/getstarted.htm

    In the meantime..........

    First...create a backup copy of your original workbook.

    To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

    Hit CRTL + R to open Project Explorer.

    Find your workbook/project and select it.

    Right-click and Insert>Module. Paste the code in there. Save the
    workbook and hit ALT + Q to return to your workbook.


    Gord Dibben Excel MVP

    On Thu, 3 Feb 2005 10:09:02 -0800, "robin" <robin@discussions.microsoft.com>
    wrote:

    >I want to make a custome borders icon to use on the tool bar. I need a
    >double line at the top and a single line at the bottom. PLease help, Robin



  4. #4
    robin
    Guest

    Re: custom borders icon to use on the tool bar

    Thank you,
    It works, the only thing is, it does not allow me to undo it without
    clearing the borders using the clear borders button. Is there an additional
    command I can put into the macros to allow the undo feature to work?
    Thanks, Robin

    "Gord Dibben" wrote:

    > robin
    >
    > This is the code I got when I recorded a macro while formatting as you
    > describe.
    >
    > Copy/paste to a general module in your workbook. For instructions on creating
    > a general module see below.
    >
    > Assign it to a button on your Toolbar.
    >
    > Sub Macro2()
    > With Selection.Borders(xlEdgeTop)
    > .LineStyle = xlDouble
    > .Weight = xlThick
    > .ColorIndex = xlAutomatic
    > End With
    > With Selection.Borders(xlEdgeBottom)
    > .LineStyle = xlContinuous
    > .Weight = xlThin
    > .ColorIndex = xlAutomatic
    > End With
    > End Sub
    >
    > To get a button to the Toolbar you can.........
    >
    > Tools>Customize>Commands>Macros.
    >
    > Drag the smiley-face to the Toolbar.
    >
    > Right-click on it a Assign Macro and also "Change Button Image" if you wish.
    >
    > OK your way out.
    >
    > If not familiar with VBA and macros, see David McRitchie's site for more on
    > "getting started".
    >
    > http://www.mvps.org/dmcritchie/excel/getstarted.htm
    >
    > In the meantime..........
    >
    > First...create a backup copy of your original workbook.
    >
    > To create a General Module, hit ALT + F11 to open the Visual Basic Editor.
    >
    > Hit CRTL + R to open Project Explorer.
    >
    > Find your workbook/project and select it.
    >
    > Right-click and Insert>Module. Paste the code in there. Save the
    > workbook and hit ALT + Q to return to your workbook.
    >
    >
    > Gord Dibben Excel MVP
    >
    > On Thu, 3 Feb 2005 10:09:02 -0800, "robin" <robin@discussions.microsoft.com>
    > wrote:
    >
    > >I want to make a custome borders icon to use on the tool bar. I need a
    > >double line at the top and a single line at the bottom. PLease help, Robin

    >
    >


  5. #5
    Gord Dibben
    Guest

    Re: custom borders icon to use on the tool bar

    robin

    For sample "Undo" code see John Walkenbach's site.

    http://www.j-walk.com/ss/excel/tips/tip23.htm


    Gord

    On Thu, 10 Feb 2005 11:15:02 -0800, "robin" <robin@discussions.microsoft.com>
    wrote:

    >Thank you,
    >It works, the only thing is, it does not allow me to undo it without
    >clearing the borders using the clear borders button. Is there an additional
    >command I can put into the macros to allow the undo feature to work?
    >Thanks, Robin
    >
    >"Gord Dibben" wrote:
    >
    >> robin
    >>
    >> This is the code I got when I recorded a macro while formatting as you
    >> describe.
    >>
    >> Copy/paste to a general module in your workbook. For instructions on creating
    >> a general module see below.
    >>
    >> Assign it to a button on your Toolbar.
    >>
    >> Sub Macro2()
    >> With Selection.Borders(xlEdgeTop)
    >> .LineStyle = xlDouble
    >> .Weight = xlThick
    >> .ColorIndex = xlAutomatic
    >> End With
    >> With Selection.Borders(xlEdgeBottom)
    >> .LineStyle = xlContinuous
    >> .Weight = xlThin
    >> .ColorIndex = xlAutomatic
    >> End With
    >> End Sub
    >>
    >> To get a button to the Toolbar you can.........
    >>
    >> Tools>Customize>Commands>Macros.
    >>
    >> Drag the smiley-face to the Toolbar.
    >>
    >> Right-click on it a Assign Macro and also "Change Button Image" if you wish.
    >>
    >> OK your way out.
    >>
    >> If not familiar with VBA and macros, see David McRitchie's site for more on
    >> "getting started".
    >>
    >> http://www.mvps.org/dmcritchie/excel/getstarted.htm
    >>
    >> In the meantime..........
    >>
    >> First...create a backup copy of your original workbook.
    >>
    >> To create a General Module, hit ALT + F11 to open the Visual Basic Editor.
    >>
    >> Hit CRTL + R to open Project Explorer.
    >>
    >> Find your workbook/project and select it.
    >>
    >> Right-click and Insert>Module. Paste the code in there. Save the
    >> workbook and hit ALT + Q to return to your workbook.
    >>
    >>
    >> Gord Dibben Excel MVP
    >>
    >> On Thu, 3 Feb 2005 10:09:02 -0800, "robin" <robin@discussions.microsoft.com>
    >> wrote:
    >>
    >> >I want to make a custome borders icon to use on the tool bar. I need a
    >> >double line at the top and a single line at the bottom. PLease help, Robin

    >>
    >>



Closed Thread

Thread Information

Users Browsing this Thread

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

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