Dividing a cell by constant value

jlloyd123

New Member
Joined
Jan 31, 2018
Messages
6
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Range("C43:E43")
On Error GoTo ws_exit:
If Not Intersect(Target, rng) Is Nothing Then
Application.EnableEvents = False
Target.Value = Target.Value / .50
End If
ws_exit:
Application.EnableEvents = True
End Sub

I've read about decimals and I've tried to do ".50" and "1/ 2" - When I run this code, it just deletes what I have in my cell. PLEASE HELP! I have to do one cell divided by .50 and one divided by .30. I don't really know what I'm doing at all (obviously) but this is code that I used on a cell I needed to multiply by 1.25. I just changed the * to a /.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,224,828
Messages
6,181,206
Members
453,022
Latest member
RobertV1609

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