Value Divide and set in cell

Hjemmet

Board Regular
Joined
Jun 20, 2018
Messages
207
Hey
is this possibel in VBA code

if i have a Empty cell ("F16") then Value from ("F15") is Divide with "2" But if value in ("F15") is Odd then Add +1 to value in ("F15") and then Divide with 2 and then Value is Put into Cell("F16") is that Possibel

i have look and search around Google but didn Find any solution about it


the same function should work in Colomn "F" to "R" on Row "16"

And if cell Empty ("F19") then Value from ("F18") is Divide with "2" But if value in ("F19") is Odd then Add +1 to value in ("F18") and then Divide with 2 and then Value is Put into Cell("F19")

this is the code i have in My workbook for other cell's

Code:
[/COLOR]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)    
    
    If Target.Value = "" Then
   Range("F15").Value = Target.Value / 2


ElseIf Target.Value = "41" Then
   Range("16").Value = "41"


    
    On Error Resume Next
    If Not Intersect(Target, Range("F10:R19")) Is Nothing Then
        If Target.Value Mod 2 = 1 Then Target.Value = Target.Value + 1
      'Target.Value = Target.Value + 1
      'Range("F10").Value = Range("F10").Value + 1
            Target.Value = Target.Value / 2
      Cancel = True
    End If
    End If
End Sub


[COLOR=#333333]
 
Last edited:
i think i get a better Idea with those Different Scores

If no score then Value on Total score line "Row 21" is Divide with 2 if value not is odd ,If odd value then add "1" to score before divide....
instead of every cell
By dobbelclick in Colomn "F10:F19" for player 1 and so on for each Player until player 13 in Colomn "R10:R19"
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Not for the moment

thanks for your Try in first Question, Ill be Back if i need further Help with my New Idea

Thanks Alot
 
Upvote 0
Your welcome. I hope you succeed with that option.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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