R
RC
Any help is greatly appreciated.
I'm not big on writing these, I usually take something I have and modify it,
so please keep it simple.
As you can see from the included vb all I'm trying to do is replace a
specific character and remove the CRLF. These are causing a major problem
when importing into one of my other applications. It works fine on one or a
small group of cells, but if I select the entire sheet....well last time
after 30 minutes I just gave up. What am I doing wrong?
Sub ClearCRLFComma()
For Each Cell In Selection
temp = Cell.Text
For i = 1 To Len(temp) Step 1
a = Mid(temp, i, 1)
If a = vbCrLf Or a = vbCr Or a = vbLf Then
Mid(temp, i, 1) = " "
End If
If a = "," Then
Mid(temp, i, 1) = "-"
End If
Next i
Cell.Value = temp
Next
End Sub
In a perfect world I'd want a single button macro that did all of the
following;
What' in the above vb.
Remove (delete) all text that is bold (this removes a bunch of meaningless
labels).
Reformat the entire sheet as "General" or "Text" (no "Currency", "Number",
or "Date")
Swap the values of two cells in a row only if there is a value in the second
cell (i.e. A2=x and A3 is blank then do nothing. But if A2=x and A3=y then
swap the values so that A2=y and A3=x).
And then save it as a .csv file.
If anyone has any suggestion on what I can do (keep it clean) to accomplish
this, let me know.
Thanks in advance
RC
I'm not big on writing these, I usually take something I have and modify it,
so please keep it simple.
As you can see from the included vb all I'm trying to do is replace a
specific character and remove the CRLF. These are causing a major problem
when importing into one of my other applications. It works fine on one or a
small group of cells, but if I select the entire sheet....well last time
after 30 minutes I just gave up. What am I doing wrong?
Sub ClearCRLFComma()
For Each Cell In Selection
temp = Cell.Text
For i = 1 To Len(temp) Step 1
a = Mid(temp, i, 1)
If a = vbCrLf Or a = vbCr Or a = vbLf Then
Mid(temp, i, 1) = " "
End If
If a = "," Then
Mid(temp, i, 1) = "-"
End If
Next i
Cell.Value = temp
Next
End Sub
In a perfect world I'd want a single button macro that did all of the
following;
What' in the above vb.
Remove (delete) all text that is bold (this removes a bunch of meaningless
labels).
Reformat the entire sheet as "General" or "Text" (no "Currency", "Number",
or "Date")
Swap the values of two cells in a row only if there is a value in the second
cell (i.e. A2=x and A3 is blank then do nothing. But if A2=x and A3=y then
swap the values so that A2=y and A3=x).
And then save it as a .csv file.
If anyone has any suggestion on what I can do (keep it clean) to accomplish
this, let me know.
Thanks in advance
RC