PDA

View Full Version : VBA to run formula on Selected cells



mduff
06-22-2014, 11:39 AM
Hi,

I need some help with some VBA that will run the MOD formula on all selected cells and replace the cells contents with the result of the formula for example if A1 is selected run MOD(A1,1) on it then replace whats in A1 with the results

thanks a lot in advance

mancubus
06-22-2014, 12:49 PM
hi.

syntax: Number MOD Divisor



Sub mod_range()

Dim cll As Range

For Each cll In Selection 'instead of Selection use, for ex, Range("A1:F12")
cll.Value = cll.Value Mod 1
Next cll

End Sub




really need Mod 1 of numbers in range?