VBA Macro to Find and Replace the Omega/Ohm Symbol

Nfelsman

New Member
Joined
Jan 18, 2011
Messages
1
I picked a doozy for my first post. I've been searching all over the net all day to find out how to make a macro that will find and replace the Omega/Ohm symbol. I've found plenty of macros that can do a simple find and replace, but where I'm having trouble is with representing the Omega symbol in VBA.

I've checked the 255 characters that result from the "=CODE" function to see if I could get it to work that way, but the Omega symbol isn't on there.

If there ends up not being a way to represent the Ohm symbol in VBA, is there a macro that will eliminate all special characters in general? Like these: µ ® © ™ ° Ω ¼ ½ ¾ ¥ ¿ Æ …

Thanks to anyone that can help me figure this out :confused:
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I picked a doozy for my first post. I've been searching all over the net all day to find out how to make a macro that will find and replace the Omega/Ohm symbol. I've found plenty of macros that can do a simple find and replace, but where I'm having trouble is with representing the Omega symbol in VBA.

I've checked the 255 characters that result from the "=CODE" function to see if I could get it to work that way, but the Omega symbol isn't on there.

If there ends up not being a way to represent the Ohm symbol in VBA, is there a macro that will eliminate all special characters in general? Like these: µ ® © ™ ° Ω ¼ ½ ¾ ¥ ¿ Æ …

Thanks to anyone that can help me figure this out :confused:


I think the below code should do the trick:

Code:
Sub No_omegas()

    Dim rg As Range
    Dim x As Long
    
    x = 937 'Omega charcter
    Set rg = Selection
    
    rg.Replace What:=ChrW(x), Replacement:="", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, MatchByte:=False
    
End Sub

Thanks to the omnipotent Andrew_Poulsom for the tip on AscW() to determine the right ChrW code!

Ben.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,688
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top