Excel 2013 VB to re-calculate data entry value on exit from cell? -
i have spreadsheet, need manually enter values external sources. 3 of these cells, there decimal value: ex: 66.78, 28.5, 0.5171
i able enter digits (without decimal) and, on exiting cell, have vb code appropriate division each column (but without duplicating division if later edited...).
that is: type in 6678, , cursor moves next cell, vb divides 100. type in 285, vb divides 1 10. next 1 divided 10000.
brute force solution enter integers elsewhere, , have division formula want decimal values. but, similar code have 1 cell's text turn uppercase when leaving cell, expect there's way run code fragment on cell's numeric value - here's uppercase code:
private sub worksheet_change(byval target range) if not (application.intersect(target, range("$d11:$d$110")) _ nothing) target if not .hasformula application.enableevents = false .value = ucase(.value) application.enableevents = true end if end end if end sub
to avoid duplication, if editing original value, ideal like:
"on_exit cell, if cell.value > 100, x/100, else x" first one.
i'm hoping there's minor tweak the
.value = ucase(.value)
snippet numeric calculation. thoughts?
Comments
Post a Comment