#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 191
Default style button

I need a button installed on my standard toolbar, which will have behind it a
custom format/style (just as comma/percent/dollar do). Any help?

--
Boris
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default style button

Lots of people have a workbook named personal.xls that's stored in their XLStart
folder.

This file is usually hidden from you when you're working in excel, but all of
the macros stored in that workbook's project will be available to you.

So you could create a macro that would apply the custom numberformat you want
and save it in your personal.xls workbook.

Then you could modify the toolbar
Tools|Customize|commands tab|Macros category
Drag the custom button icon to the standard toolbar where you want it.

As long as that tools|customize dialog is visible, you can change stuff
associated with that new icon--including the macro that it calls--and the face
of the icon.

Change the face (and Name) to what you want.
And assign the macro in your personal.xls workbook to this icon.

This may be what your macro could look like:

Option Explicit
Sub SpecialFormat()
On Error Resume Next
Selection.NumberFormat = "$#,##0.00"
If Err.Number < 0 Then
Beep
Err.Clear
End If
On Error GoTo 0
End Sub



BorisS wrote:

I need a button installed on my standard toolbar, which will have behind it a
custom format/style (just as comma/percent/dollar do). Any help?

--
Boris


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 191
Default style button

Dave, thanks much. Any chance you could briefly translate the macro into
what it's accomplishing? Sort of the 'teach the man to fish' syndrome in me,
who wants to know what the steps are, for future use.

Appreciate the guidance on the general steps to take.


--
Boris


"Dave Peterson" wrote:

Lots of people have a workbook named personal.xls that's stored in their XLStart
folder.

This file is usually hidden from you when you're working in excel, but all of
the macros stored in that workbook's project will be available to you.

So you could create a macro that would apply the custom numberformat you want
and save it in your personal.xls workbook.

Then you could modify the toolbar
Tools|Customize|commands tab|Macros category
Drag the custom button icon to the standard toolbar where you want it.

As long as that tools|customize dialog is visible, you can change stuff
associated with that new icon--including the macro that it calls--and the face
of the icon.

Change the face (and Name) to what you want.
And assign the macro in your personal.xls workbook to this icon.

This may be what your macro could look like:

Option Explicit
Sub SpecialFormat()
On Error Resume Next
Selection.NumberFormat = "$#,##0.00"
If Err.Number < 0 Then
Beep
Err.Clear
End If
On Error GoTo 0
End Sub



BorisS wrote:

I need a button installed on my standard toolbar, which will have behind it a
custom format/style (just as comma/percent/dollar do). Any help?

--
Boris


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default style button

Option Explicit
Sub SpecialFormat()
On Error Resume Next
Selection.NumberFormat = "$#,##0.00"
If Err.Number < 0 Then
Beep
Err.Clear
End If
On Error GoTo 0
End Sub

It's not really doing too much. The line that tries to do all the work is:
Selection.NumberFormat = "$#,##0.00"

That's just changing the number format.

The other stuff is just to make it so that if something goes wrong, you don't
get any messages. If the worksheet is protected, then you may not be able to
change the format. So instead of having the macro blow up, it just beeps at
you.


BorisS wrote:

Dave, thanks much. Any chance you could briefly translate the macro into
what it's accomplishing? Sort of the 'teach the man to fish' syndrome in me,
who wants to know what the steps are, for future use.

Appreciate the guidance on the general steps to take.

--
Boris

"Dave Peterson" wrote:

Lots of people have a workbook named personal.xls that's stored in their XLStart
folder.

This file is usually hidden from you when you're working in excel, but all of
the macros stored in that workbook's project will be available to you.

So you could create a macro that would apply the custom numberformat you want
and save it in your personal.xls workbook.

Then you could modify the toolbar
Tools|Customize|commands tab|Macros category
Drag the custom button icon to the standard toolbar where you want it.

As long as that tools|customize dialog is visible, you can change stuff
associated with that new icon--including the macro that it calls--and the face
of the icon.

Change the face (and Name) to what you want.
And assign the macro in your personal.xls workbook to this icon.

This may be what your macro could look like:

Option Explicit
Sub SpecialFormat()
On Error Resume Next
Selection.NumberFormat = "$#,##0.00"
If Err.Number < 0 Then
Beep
Err.Clear
End If
On Error GoTo 0
End Sub



BorisS wrote:

I need a button installed on my standard toolbar, which will have behind it a
custom format/style (just as comma/percent/dollar do). Any help?

--
Boris


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
button for style BorisS Excel Discussion (Misc queries) 0 March 10th 08 02:11 AM
Currency Style Button Jon5001 Excel Discussion (Misc queries) 4 July 4th 06 03:58 AM
Currency Style button Anita Excel Discussion (Misc queries) 3 April 18th 05 12:48 AM
Accounting Style Number Button Sabine Excel Worksheet Functions 3 February 2nd 05 05:25 PM
Icon button - font/style cvgairport Excel Discussion (Misc queries) 1 December 2nd 04 12:51 AM


All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"