Hi all,
Can anyone help with a macro that will replace blank spaces with an underscore, but in row 1 only?
i.e. Peter Rabbit = Peter_Rabbit.
Forever in your debt,
~Wayne
Hi all,
Can anyone help with a macro that will replace blank spaces with an underscore, but in row 1 only?
i.e. Peter Rabbit = Peter_Rabbit.
Forever in your debt,
~Wayne
Try this:
Option Explicit Sub QuickReplace() Dim Cell As Range Application.ScreenUpdating = False For Each Cell In Range("1:1").SpecialCells(xlConstants) Cell = Replace(Cell, " ", "_") Next Cell Application.ScreenUpdating = True End Sub
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
Thank you!!!
~Wayne
If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks