Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Increase decimal macro

I have the following problem:
I often want to change the position of the decimal place in a cel (i.e.,
change its NumberFormat). However, i am too lazy to use the toolbar button.
Instead, I need something i can bind to a shortcutkey. Unfortunately,
recording the macro yields no interesting results.

Is there a simple, general way to do what I am thinking of, or must the code
for such a macro be necessarily long?

Any help would be appreciated! Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Increase decimal macro

something like

c=c.offset*17.5%
c.numberformat="0.00"

Peter
-----Original Message-----
I have the following problem:
I often want to change the position of the decimal place

in a cel (i.e.,
change its NumberFormat). However, i am too lazy to use

the toolbar button.
Instead, I need something i can bind to a shortcutkey.

Unfortunately,
recording the macro yields no interesting results.

Is there a simple, general way to do what I am thinking

of, or must the code
for such a macro be necessarily long?

Any help would be appreciated! Thanks.


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Increase decimal macro

I had not thought of doing that (didn't know it was possible)! Thanks,
Dave.





"Dave Peterson" wrote in message
...
You could write a routine that would parse the .numberformat of each cell

in the
selection, but man, there's lots of .numberformats that those buttons

respect!

Maybe just running the buttons:

Option Explicit
Sub increaseDecimal()
Application.CommandBars("formatting").FindControl( ID:=398).Execute
End Sub
Sub decreasedecimal()
Application.CommandBars("formatting").FindControl( ID:=399).Execute
End Sub




R Avery wrote:

No, what I am looking for is a lot more general.

I want to have a macro called "IncrementDecimal", or something like

that, so
that when i press the shortcutkey it is bound to, it will increase the
decimal of all cells in the selection by 1, just like the button on the
toolbar.

Similarly, I would want a "DecrementDecimal" macro that would do the
reverse.

For example, if i had cells A1:A3 like this
$1,030.45
45.813%
1.1

Then the "DecrementDecimal" macro would, if A1:A3 is selected, change it

to
the following:
$1,030.5
45.81%
1


--

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
Macro to increase to next column mickcatron Excel Discussion (Misc queries) 1 February 4th 11 12:34 PM
Increase & Decrease Decimal Place Aaron Excel Worksheet Functions 6 December 9th 08 01:27 AM
increase/decrease decimal cbfinancial Excel Worksheet Functions 2 April 10th 06 10:43 PM
Increase number of macro names Richard F. Excel Worksheet Functions 1 October 20th 05 04:04 PM
Increase/decrease decimal code Chris Excel Programming 3 November 19th 03 08:50 PM


All times are GMT +1. The time now is 01:19 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"