ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Equate numbers to text (https://www.excelbanter.com/excel-worksheet-functions/172208-equate-numbers-text.html)

hpum

Equate numbers to text
 
What is the correct feature and term used to change a value of non-contiguous
cells all at once. I would like to equate a particular number to a name
(text) and have excel automatically lookup all those numbers in the workbook
and change.

Gary''s Student

Equate numbers to text
 
Let's say we have a pile of cells that contain 3.14 and we wish to change all
of them at once. First run this macro:

Sub mersion()
Set r = Nothing
For Each rr In ActiveSheet.UsedRange
v = rr.Value
If v = 3.14 Then
If r Is Nothing Then
Set r = rr
Else
Set r = Union(r, rr)
End If
End If
Next
r.Select
End Sub

This will Select all cells with the value 3.14.

Next in the formula bar enter:
3.1415926 and touch CNTRL-ENTER rather than just ENTER

This changes all the cells at once. Two comments:

1. you can assign a Named Range to the pile after running the macro
2. consider using only a single cell for common values
--
Gary''s Student - gsnu200764


"hpum" wrote:

What is the correct feature and term used to change a value of non-contiguous
cells all at once. I would like to equate a particular number to a name
(text) and have excel automatically lookup all those numbers in the workbook
and change.



All times are GMT +1. The time now is 04:00 PM.

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