I have a Worksheet with 7,000 rows, some of which have shading.
In one of the columns, I started the last 4-digits of a credit card number with a hyphen.
Over time, I have come to see that if you start the numbers with a hyphen, it requires you to have the hidden, leading apostrophe, which is annoying.
I have been trying to simplify things . . . I got rid of the hyphens with this macro:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sub Del_Hyphens()
' https://stackoverflow.com/questions/25530193/excel-find-and-replace-macro-one-column-only
Columns("A").Replace What:="-", _
Replacement:="", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
End Sub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
. . . but how do you get rid of the leading apostrophes? . . . here's one way:
Excel 2010 / Home / Editing / Clear - Clear Formats
This isn't bad. Then I just have to change the font back (and maybe the size? I don't think I had to)
. . . but, this also gets rid of the shading, that occurs variously, throughout the 7,000 rows.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I have already just fixed it manually, but, isn't there something I could have done with a macro, like I did for the hyphen?
For example, whatever is behind what the "Clear Formats" does, is there a breakdown like for the hyphen macro, where I could de-select for it to clear shading?
In one of the columns, I started the last 4-digits of a credit card number with a hyphen.
Over time, I have come to see that if you start the numbers with a hyphen, it requires you to have the hidden, leading apostrophe, which is annoying.
I have been trying to simplify things . . . I got rid of the hyphens with this macro:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sub Del_Hyphens()
' https://stackoverflow.com/questions/25530193/excel-find-and-replace-macro-one-column-only
Columns("A").Replace What:="-", _
Replacement:="", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
End Sub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
. . . but how do you get rid of the leading apostrophes? . . . here's one way:
Excel 2010 / Home / Editing / Clear - Clear Formats
This isn't bad. Then I just have to change the font back (and maybe the size? I don't think I had to)
. . . but, this also gets rid of the shading, that occurs variously, throughout the 7,000 rows.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I have already just fixed it manually, but, isn't there something I could have done with a macro, like I did for the hyphen?
For example, whatever is behind what the "Clear Formats" does, is there a breakdown like for the hyphen macro, where I could de-select for it to clear shading?