Automatically divide a cell

darryl_co

New Member
Joined
Dec 18, 2010
Messages
2
Hi,
I want to enter data in a cell in the form of paise and get it converted to rupee i.e divide by 100, as soon as I press enter key.E.g:26.94 should show 0.2694.In custom formatting I can multiply by entering * 100 in Type area but cannot divide.How do achieve this ?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Another way: right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If IsNumeric(Target.Value) Then
    Application.EnableEvents = False
    Target.Value = Target.Value / 100
    Application.EnableEvents = True
End If
End Sub

then press ALT + Q to close the code window.
 
Upvote 0
Sorry Gohar I tried that before but it did not work.Thanks very much VoG the code works perfect and my problem is solved.Thank you again.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,755
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top