ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro that returns a specific number of characters from a text str (https://www.excelbanter.com/excel-discussion-misc-queries/152642-macro-returns-specific-number-characters-text-str.html)

Jurassien

Macro that returns a specific number of characters from a text str
 
Hello,
I need in Helps in developing a macro that will remove double quotes between
characters ( i.e. "1234N") in a specific column within the spreadsheet.
Using the MID Function does seem to take alot of time. Thus, I would like to
come up with a macro that will do faster.

Thanks,


Pete_UK

Macro that returns a specific number of characters from a text str
 
Have you tried Find & Replace (CTRL-H) ? Highlight your column, then
CTRL-H and in the pop-up enter:

Find what: "
Replace with: leave blank

Then click Replace All. Job done.

Hope this helps.

Pete

On Aug 1, 10:18 pm, Jurassien
wrote:
Hello,
I need in Helps in developing a macro that will remove double quotes between
characters ( i.e. "1234N") in a specific column within the spreadsheet.
Using the MID Function does seem to take alot of time. Thus, I would like to
come up with a macro that will do faster.

Thanks,




Dave O

Macro that returns a specific number of characters from a text str
 
I did a search and replace, looking for double quotes and replacing
with nothing, which worked. If you REALLY need a macro to do it, this
one will:

Sub RemoveQuotes()
Dim rCell As Range
Dim CellVal As String
Dim NewVal As String
Dim K As Byte
Application.Calculation = xlCalculationManual

For Each rCell In Selection.Cells
CellVal = Trim(rCell.Value)
rCell.ClearContents
For K = 1 To Len(CellVal)
If Asc(Mid(CellVal, K, 1)) < 34 Then
NewVal = NewVal & Mid(CellVal, K, 1)
End If
Next K
rCell.Value = NewVal
NewVal = ""
Next rCell
Application.Calculation = xlCalculationAutomatic
End Sub



All times are GMT +1. The time now is 06:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com