Replace All Underscores in Range with Space

dwhitey1124

New Member
Joined
Oct 24, 2014
Messages
28
Hi all, I have been trolling the forum for the last few hours trying every .replace code I could find but to no avail. I would like to insert code into an existing macro that calculates sheet 2. The sheet is full of index functions that pull categories with underscores from sheet 1 (underscores needed because they are named ranges). On this new sheet they are just text so I would like to replace the underscores with spaces. In order to streamline calculations, I would like the replace underscore to only apply to c2:e200. I'm willing to try anything after numerous failed attempts. Thanks in advance.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi,
Try this:
Rich (BB code):
  On Error Resume Next
  Sheets(2).Range("C2:E200").Replace "_", " ", LookAt:=xlPart
  On Error GoTo 0
Use Sheets("Sheet2") where Sheet2 is the tab name instead of Sheets(2) if required
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

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