ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cleaning up text macro by Alan Barasch (https://www.excelbanter.com/excel-programming/396643-cleaning-up-text-macro-alan-barasch.html)

Steve G

cleaning up text macro by Alan Barasch
 
I downloaded from the web at the following site

http://www.xl.barasch.com/ACl12117.htm

code (except for a change I made in the dim statement becasue Mr.
Barasch made an honest mistake by confusing RowCount and CountRow and
some comments I added) by Alan Barash for cleaning up data in Excel
that was imported from a text file. The code is below. I cannot get
it to work. I suspect that something comes after

Sheet.Cells(CountRow, CountCol).Value =

but I do not know what to enter.

Any help would be appreciated. Thank you.

Steve G



Option Explicit

'Cleaning up those non-printing ASCII characters after a text import
'web page for code is: www.xl.barasch.com/ACl12117.htm Alan Barasch
Sub CleaningImportedText()
Dim CountRow As Long, CountCol As Long, Sheet As Object
Set Sheet = Application.ActiveSheet
Application.ScreenUpdating = False
For CountRow = 1 To 500
For CountCol = 1 To 50
Sheet.Cells(CountRow, CountCol).Value =
Application.WorksheetFunction.Clean (Sheet.Cells(CountRow,
CountCol).Value)
Next CountCol
Next CountRow
Application.ScreenUpdating = True
End Sub


p45cal[_50_]

cleaning up text macro by Alan Barasch
 
Sheet.Cells(CountRow, CountCol).Value =
Application.WorksheetFunction.Clean (Sheet.Cells(CountRow,
CountCol).Value)

should all be on one line.
--
p45cal


"Steve G" wrote:

I downloaded from the web at the following site

http://www.xl.barasch.com/ACl12117.htm

code (except for a change I made in the dim statement becasue Mr.
Barasch made an honest mistake by confusing RowCount and CountRow and
some comments I added) by Alan Barash for cleaning up data in Excel
that was imported from a text file. The code is below. I cannot get
it to work. I suspect that something comes after

Sheet.Cells(CountRow, CountCol).Value =

but I do not know what to enter.

Any help would be appreciated. Thank you.

Steve G



Option Explicit

'Cleaning up those non-printing ASCII characters after a text import
'web page for code is: www.xl.barasch.com/ACl12117.htm Alan Barasch
Sub CleaningImportedText()
Dim CountRow As Long, CountCol As Long, Sheet As Object
Set Sheet = Application.ActiveSheet
Application.ScreenUpdating = False
For CountRow = 1 To 500
For CountCol = 1 To 50
Sheet.Cells(CountRow, CountCol).Value =
Application.WorksheetFunction.Clean (Sheet.Cells(CountRow,
CountCol).Value)
Next CountCol
Next CountRow
Application.ScreenUpdating = True
End Sub



Steve G

cleaning up text macro by Alan Barasch
 
On Aug 30, 5:48 pm, p45cal wrote:
Sheet.Cells(CountRow, CountCol).Value =
Application.WorksheetFunction.Clean (Sheet.Cells(CountRow,
CountCol).Value)

should all be on one line.
--
p45cal



"Steve G" wrote:
I downloaded from the web at the following site


http://www.xl.barasch.com/ACl12117.htm


code (except for a change I made in the dim statement becasue Mr.
Barasch made an honest mistake by confusing RowCount and CountRow and
some comments I added) by Alan Barash for cleaning up data in Excel
that was imported from a text file. The code is below. I cannot get
it to work. I suspect that something comes after


Sheet.Cells(CountRow, CountCol).Value =


but I do not know what to enter.


Any help would be appreciated. Thank you.


Steve G


Option Explicit


'Cleaning up those non-printing ASCII characters after a text import
'web page for code is: www.xl.barasch.com/ACl12117.htm Alan Barasch
Sub CleaningImportedText()
Dim CountRow As Long, CountCol As Long, Sheet As Object
Set Sheet = Application.ActiveSheet
Application.ScreenUpdating = False
For CountRow = 1 To 500
For CountCol = 1 To 50
Sheet.Cells(CountRow, CountCol).Value =
Application.WorksheetFunction.Clean (Sheet.Cells(CountRow,
CountCol).Value)
Next CountCol
Next CountRow
Application.ScreenUpdating = True
End Sub- Hide quoted text -


- Show quoted text -


To p45cal--Thank you. Steve G



All times are GMT +1. The time now is 07:27 AM.

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