jackharper2548
New Member
- Joined
- Jul 23, 2024
- Messages
- 2
- Office Version
- 365
Good afternoon,
I need help to develop a macro for a button. I have an SS where i paste in a string of text to cell A1 for example HLX/DBI/123456 Bloggs, Mr Joe
I have a button and macro that removes the forward slash /, the spaces, the comma and full stops and replaces them with an underscore _ as per the below VBA which works perfectly.
<Sub CleanUpfile()
Cells.Select
Range("A1").Activate
Selection.Replace What:="/", Replacement:="_", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Selection.Replace What:=",", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Selection.Replace What:=" ", Replacement:="_", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Selection.Replace What:=".", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
End Sub/>
What i need now is a macro that will copy the cleaned up version of the text for example HLX_DBI_123456_BLOGGS_MR_JOE and create two new versions of this one with L_ at the start and one with INV_ at the start for example
L_HLX_DBI_123456_BLOGGS_MR_JOE
INV_HLX_DBI_123456_BLOGGS_MR_JOE
Can anyone help me work this one out?
I need help to develop a macro for a button. I have an SS where i paste in a string of text to cell A1 for example HLX/DBI/123456 Bloggs, Mr Joe
I have a button and macro that removes the forward slash /, the spaces, the comma and full stops and replaces them with an underscore _ as per the below VBA which works perfectly.
<Sub CleanUpfile()
Cells.Select
Range("A1").Activate
Selection.Replace What:="/", Replacement:="_", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Selection.Replace What:=",", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Selection.Replace What:=" ", Replacement:="_", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Selection.Replace What:=".", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
End Sub/>
What i need now is a macro that will copy the cleaned up version of the text for example HLX_DBI_123456_BLOGGS_MR_JOE and create two new versions of this one with L_ at the start and one with INV_ at the start for example
L_HLX_DBI_123456_BLOGGS_MR_JOE
INV_HLX_DBI_123456_BLOGGS_MR_JOE
Can anyone help me work this one out?