View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Increase & Decrease Decimal Place

Give these a try...

Sub DPshiftdown()
With Range("Q16")
If .NumberFormat = "0 \g" Or .NumberFormat = "General" Then Exit Sub
.NumberFormat = Replace(.NumberFormat, " \g", "")
.NumberFormat = Trim(Left(.NumberFormat, Len(.NumberFormat) - 1))
If Right(.NumberFormat, 1) = "." Then .NumberFormat = Val(.NumberFormat)
.NumberFormat = .NumberFormat & " \g"
End With
End Sub

Sub DPshiftup()
With Range("Q16")
.NumberFormat = Replace(.NumberFormat, " \g", "")
If .NumberFormat = "0" Or .NumberFormat = "General" Then
.NumberFormat = "0.0 \g"
Else
.NumberFormat = .NumberFormat & "0 \g"
.NumberFormat = Replace(.NumberFormat, "0000", "000 0")
End If
End With
End Sub

--
Rick (MVP - Excel)


"Aaron" wrote in message
...
On Dec 9, 1:17 pm, "Rick Rothstein"
wrote:
Wow thank-you this has been a problem i have been trying
to solve for 2 years now, but no one else fully understood
my Q and subsequently the suggestions didnt work.


I'm glad I was able to be of help.

--
Rick (MVP - Excel)


Actually, any chance of adding the letter "g" after the zeroes so it
goes 0.000 0 g? That would solve the other question I posted. If not
how could I achieve this?

TIA

Aaron.