用蓝色棱镜从excel中删除换行符,
Removing line break from exel with blue prism,
我得到了一个 excel-sheet,里面有很多换行符。
Blue Prism 无法读取换行符(并给我一个错误),所以我必须 remove/replace 它们。
我不知道该怎么做。
VBA 对我不起作用...不知道为什么。在 excel 它有效,在代码阶段有很多编译器错误。
Cells.Replace What:="" & Chr(10) & "", Replacement:=",", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Screenshot VBA
这是我用来删除空白行的。您可以突出显示行或单元格区域。
Sub DeleteBlankRows()
Dim rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "Delete Range"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
xRows = WorkRng.Rows.Count
Application.ScreenUpdating = False
For i = xRows To 1 Step -1
If Application.WorksheetFunction.CountA(WorkRng.Rows(i)) = 0 Then
WorkRng.Rows(i).EntireRow.Delete XlDeleteShiftDirection.xlShiftUp
End If
Next
Application.ScreenUpdating = True
End Sub
我得到了一个 excel-sheet,里面有很多换行符。 Blue Prism 无法读取换行符(并给我一个错误),所以我必须 remove/replace 它们。 我不知道该怎么做。
VBA 对我不起作用...不知道为什么。在 excel 它有效,在代码阶段有很多编译器错误。
Cells.Replace What:="" & Chr(10) & "", Replacement:=",", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Screenshot VBA
这是我用来删除空白行的。您可以突出显示行或单元格区域。
Sub DeleteBlankRows()
Dim rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "Delete Range"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
xRows = WorkRng.Rows.Count
Application.ScreenUpdating = False
For i = xRows To 1 Step -1
If Application.WorksheetFunction.CountA(WorkRng.Rows(i)) = 0 Then
WorkRng.Rows(i).EntireRow.Delete XlDeleteShiftDirection.xlShiftUp
End If
Next
Application.ScreenUpdating = True
End Sub