Change Values to Something Else

J

Jeff Jensen

I need a macro that looks for certain values on a sheet and changes them, for
example:

Change 1 to 1â€
Change 2 to 2â€
Change 11/2 to 1-1/2
Change 15/16 to 1-5/16
Change 113/16 to 1-13/16

Each of those values are in their own cell.

There are some cells that have phrases such as: “ 2 Pieces †I don’t want
that to get changed to “ 2†Pieces “

Thank you,
Jeff Jensen
 
G

Gary''s Student

Try this small macro:

Sub Jensen()
Dim oldd(10) As String
Dim neww(10) As String
dq = Chr(34)
oldd(0) = "1"
oldd(1) = "2"
oldd(2) = "11/2"
oldd(3) = "15/16"
oldd(4) = "113/16"
neww(0) = "1" & dq
neww(1) = "2" & dq
neww(2) = "1-1/2"
neww(3) = "1-5/16"
neww(4) = "1-13/16"
For Each r In ActiveSheet.UsedRange
v = r.Value
For i = 0 To 4
If v = oldd(i) Then
r.Value = neww(i)
End If
Next
Next
End Sub
 
J

Jeff Jensen

Thank you Gary''s Student!

It works great and will save me so much time on a lot of projects! I may
even be able to do some fishing this summer!

Thanks again,

Jeff Jensen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top