Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 如何整理导出的html文件的源代码?_Excel_Vba - Fatal编程技术网

Excel 如何整理导出的html文件的源代码?

Excel 如何整理导出的html文件的源代码?,excel,vba,Excel,Vba,使用VBA,我将Excel电子表格导出为网页 导出的html文件的源代码非常混乱。中间有多个换行符。例如: <td colspan="3" class="xl681522" style="height:17.1pt" height="22">Select X and Y</td> <td class="xl731522" style="width:25

使用VBA,我将Excel电子表格导出为网页

导出的html文件的源代码非常混乱。中间有多个换行符。例如:

 <td colspan="3" class="xl681522" style="height:17.1pt" height="22">Select X
  and Y</td>
<td class="xl731522" style="width:253pt" width="337">Hello World
 and my country</td>
如何整理html源代码,如:

<td colspan="3" class="xl681522" style="height:17.1pt" height="22">Select X and Y</td>
<td class="xl731522" style="width:253pt" width="337">Hello World and my country</td>

这可能会有所帮助,或者只需按住CTRL+H键,然后搜索并替换为空白 :


我不认为它已经存在,但您可以看看:欢迎使用堆栈溢出,虽然这可能会回答这个问题,但最好给出解释,而不仅仅是为您的答案编写代码。
'PURPOSE: Find & Replace a list of text/values throughout entire workbook from a table
'SOURCE: www.TheSpreadsheetGuru.com/the-code-vault, I used <p*> to <p> in the table
Dim sht As Worksheet
Dim fndList As Integer
Dim rplcList As Integer
Dim tbl As ListObject
Dim myArray As Variant

'Create variable to point to your table
  Set tbl = Worksheets("Sheet1").ListObjects("Table1")

'Create an Array out of the Table's Data
  Set TempArray = tbl.DataBodyRange
  myArray = Application.Transpose(TempArray)

'Designate Columns for Find/Replace data
  fndList = 1
  rplcList = 2

'Loop through each item in Array lists
  For x = LBound(myArray, 1) To UBound(myArray, 2)
    'Loop through each worksheet in ActiveWorkbook (skip sheet with table in it)
      For Each sht In ActiveWorkbook.Worksheets
        If sht.Name <> tbl.Parent.Name Then

          sht.Cells.Replace What:=myArray(fndList, x), Replacement:=myArray(rplcList, x), _
            LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
            SearchFormat:=False, ReplaceFormat:=False

        End If
      Next sht
  Next x

End Sub