ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Dividing by fixed number (https://www.excelbanter.com/excel-discussion-misc-queries/130309-dividing-fixed-number.html)

Colin Macleod

Dividing by fixed number
 
I want to replace a number of cells on a worksheet with new values. These
new values will be the existing value divided by 0.8775. I realise I can do
this by using EditPaste SpecialDivide - but I want to be able to see the
division in the Formula Bar rather than just the end value. At the moment,
I'm just going through on a cell-by-cell basis, and editing each one by
hand. Is there a quicker way to do this?

Thanks




Don Guillett

Dividing by fixed number
 
try
Sub dividebyformula()
For Each c In Selection
c.Formula = "=" & c & "/3"
Next
End Sub

--
Don Guillett
SalesAid Software

"Colin Macleod" wrote in message
...
I want to replace a number of cells on a worksheet with new values. These
new values will be the existing value divided by 0.8775. I realise I can do
this by using EditPaste SpecialDivide - but I want to be able to see the
division in the Formula Bar rather than just the end value. At the moment,
I'm just going through on a cell-by-cell basis, and editing each one by
hand. Is there a quicker way to do this?

Thanks






Dave O

Dividing by fixed number
 
Good morning, Colin-
Copy this bit of code and paste it in as a macro in your spreadsheet.
It modifies each formula in a range that you highlight and performs
that division you need.

Sub DivideBy()
Dim rCell As Range

For Each rCell In Selection.Cells
If Mid(rCell.Formula, 1, 1) < "=" Then rCell.Formula = "=" &
rCell.Formula
rCell.Formula = "=(" & Right(rCell.Formula, Len(rCell.Formula) - 1)
& ")/.8775"
Next rCell

End Sub


Colin Macleod

Dividing by fixed number
 
Thanks for this. Exactly what I wanted...


"Don Guillett" wrote in message
...
try
Sub dividebyformula()
For Each c In Selection
c.Formula = "=" & c & "/3"
Next
End Sub

--
Don Guillett
SalesAid Software

"Colin Macleod" wrote in message
...
I want to replace a number of cells on a worksheet with new values. These
new values will be the existing value divided by 0.8775. I realise I can
do this by using EditPaste SpecialDivide - but I want to be able to see
the division in the Formula Bar rather than just the end value. At the
moment, I'm just going through on a cell-by-cell basis, and editing each
one by hand. Is there a quicker way to do this?

Thanks








Don Guillett

Dividing by fixed number
 

Glad it helped
--
Don Guillett
SalesAid Software

"Colin Macleod" wrote in message
...
Thanks for this. Exactly what I wanted...


"Don Guillett" wrote in message
...
try
Sub dividebyformula()
For Each c In Selection
c.Formula = "=" & c & "/3"
Next
End Sub

--
Don Guillett
SalesAid Software

"Colin Macleod" wrote in message
...
I want to replace a number of cells on a worksheet with new values. These
new values will be the existing value divided by 0.8775. I realise I can
do this by using EditPaste SpecialDivide - but I want to be able to see
the division in the Formula Bar rather than just the end value. At the
moment, I'm just going through on a cell-by-cell basis, and editing each
one by hand. Is there a quicker way to do this?

Thanks











All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com