A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DP jog macro.



 
 
Thread Tools Display Modes
  #1  
Old July 15th, 2008, 06:57 AM posted to microsoft.public.excel.worksheet.functions
Aaron
external usenet poster
 
Posts: 45
Default DP jog macro.

Hey gurus,

I have had a prob for a while and thought I had sussed it but have now
realised im not quite there.

ActiveSheet.Unprotect
Range("Q16").Select
Selection.NumberFormat = "0.0"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True

I have tied this macro to a button on the worksheet, but all it is
doing is setting the cell to 0.0 dp.

What I want is a jog function, where I can press it and see the target
cell dp go up and up to 0.0, 0.00, 0.000, 0.0000 etc each time.

Can someone please help with this?

Cheers,

Aaron.
  #2  
Old July 15th, 2008, 09:08 AM posted to microsoft.public.excel.worksheet.functions
Bob Phillips[_2_]
external usenet poster
 
Posts: 1,562
Default DP jog macro.

ActiveSheet.Unprotect
With Range("Q16")
If .NumberFormat = "0" Or .NumberFormat = "General" Then

.NumberFormat = "0.0"
Else
.NumberFormat = .NumberFormat & "0"
End If
End With
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True



--
__________________________________
HTH

Bob

"Aaron" wrote in message
...
Hey gurus,

I have had a prob for a while and thought I had sussed it but have now
realised im not quite there.

ActiveSheet.Unprotect
Range("Q16").Select
Selection.NumberFormat = "0.0"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True

I have tied this macro to a button on the worksheet, but all it is
doing is setting the cell to 0.0 dp.

What I want is a jog function, where I can press it and see the target
cell dp go up and up to 0.0, 0.00, 0.000, 0.0000 etc each time.

Can someone please help with this?

Cheers,

Aaron.



  #3  
Old July 15th, 2008, 09:23 AM posted to microsoft.public.excel.worksheet.functions
Dennis
external usenet poster
 
Posts: 1,222
Default DP jog macro.

Dim strTemp as String

ActiveSheet.Unprotect
Range("Q16").Select
If Selection.NumberFormat "0.0" Then
strTemp = "0."
Else
strTemp = Selection.NumberFormat
End If
strTemp = strTemp & "0"
Selection.NumberFormat = strTemp
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

"Aaron" wrote:

Hey gurus,

I have had a prob for a while and thought I had sussed it but have now
realised im not quite there.

ActiveSheet.Unprotect
Range("Q16").Select
Selection.NumberFormat = "0.0"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True

I have tied this macro to a button on the worksheet, but all it is
doing is setting the cell to 0.0 dp.

What I want is a jog function, where I can press it and see the target
cell dp go up and up to 0.0, 0.00, 0.000, 0.0000 etc each time.

Can someone please help with this?

Cheers,

Aaron.

  #4  
Old July 15th, 2008, 09:32 AM posted to microsoft.public.excel.worksheet.functions
Dennis
external usenet poster
 
Posts: 1,222
Default DP jog macro.

Slight problem with mine, but Bobs will work OK

"Dennis" wrote:

Dim strTemp as String

ActiveSheet.Unprotect
Range("Q16").Select
If Selection.NumberFormat "0.0" Then
strTemp = "0."
Else
strTemp = Selection.NumberFormat
End If
strTemp = strTemp & "0"
Selection.NumberFormat = strTemp
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

"Aaron" wrote:

Hey gurus,

I have had a prob for a while and thought I had sussed it but have now
realised im not quite there.

ActiveSheet.Unprotect
Range("Q16").Select
Selection.NumberFormat = "0.0"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True

I have tied this macro to a button on the worksheet, but all it is
doing is setting the cell to 0.0 dp.

What I want is a jog function, where I can press it and see the target
cell dp go up and up to 0.0, 0.00, 0.000, 0.0000 etc each time.

Can someone please help with this?

Cheers,

Aaron.

  #5  
Old July 15th, 2008, 11:35 AM posted to microsoft.public.excel.worksheet.functions
Aaron
external usenet poster
 
Posts: 45
Default DP jog macro.

On Jul 15, 8:32 pm, Dennis wrote:
Slight problem with mine, but Bobs will work OK

"Dennis" wrote:
Dim strTemp as String


ActiveSheet.Unprotect
Range("Q16").Select
If Selection.NumberFormat "0.0" Then
strTemp = "0."
Else
strTemp = Selection.NumberFormat
End If
strTemp = strTemp & "0"
Selection.NumberFormat = strTemp
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True


"Aaron" wrote:


Hey gurus,


I have had a prob for a while and thought I had sussed it but have now
realised im not quite there.


ActiveSheet.Unprotect
Range("Q16").Select
Selection.NumberFormat = "0.0"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True


I have tied this macro to a button on the worksheet, but all it is
doing is setting the cell to 0.0 dp.


What I want is a jog function, where I can press it and see the target
cell dp go up and up to 0.0, 0.00, 0.000, 0.0000 etc each time.


Can someone please help with this?


Cheers,


Aaron.


Thanks Bob and Dennis I will add this code asap. It will solve a
problem I have had for a year and a half!

Cheers,

Aaron.
  #6  
Old August 6th, 2008, 02:54 AM posted to microsoft.public.excel.worksheet.functions
Aaron
external usenet poster
 
Posts: 45
Default DP jog macro.

Hi,

As well as a jog up I need also to have a jog down macro,

I tried to make this work for the dp reducing jog by removing trailing
dp like 0.00000 to 0.0000 to 0.000 to 0.00 etc but I cant seem to
modify Bobs code to get it to work.

This is as far as I got.

I need an up and a down one to go from 0 up to 0.00000 and from
0.00000 to 0 regardless of where it is at the time when the up or down
macro tied button is pressed.

ActiveSheet.Unprotect
With Range("Q16")
If .NumberFormat = "0.00000" Or .NumberFormat = "General" Then

.NumberFormat = "0.0000"

if
.NumberFormat = "0.0000" Or .NumberFormat = "General" Then

.NumberFormat = "0.000"

if
.NumberFormat = "0.000" Or .NumberFormat = "General" Then

.NumberFormat = "0.00"

if
.NumberFormat = "0.00" Or .NumberFormat = "General" Then

.NumberFormat = "0.0"

if
.NumberFormat = "0.0" Or .NumberFormat = "General" Then

.NumberFormat = "0"

End If

End With
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub

More help please!

Cheers,

Aaron.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.