日期:2014-05-18  浏览次数:21098 次

excel 用宏将日期数字类型的列转换为字符文本列 c#导入excel 日期变成数字 怎么办?这是最好的解决办法

Sub 宏1()
Dim m As String
For i = 2 To 40000
    If Cells(i, 3) <> "" Then
       m = Cells(i, 3)
       Cells(i, 3).Select
       Selection.NumberFormatLocal = "@"
       Cells(i, 3) = m
    End If
Next

End Sub

 


Sub 宏1()
    Dim AA As String
    Dim BB As String
    For I = 2 To 5000
       If Cells(I, 1) <> "" Then
          AA = Cells(I, 1)
          BB = Cells(I, 7)
          Cells(I, 1).Select
          Selection.NumberFormatLocal = "@"
          Cells(I, 7).Select
          Selection.NumberFormatLocal = "@"
          Cells(I, 1) = AA
          Cells(I, 7) = BB
       End If
    Next
End Sub

 

Sub QUTONG()
For I = 2 To 2000
   If Cells(I, 2) <> O Then
      If Cells(I - 1, 2) = Cells(I, 2) Then
         Rows(I + 1 & ":" & I + 1).Select
         Selection.Delete Shift:=xlUp
      End If
    End If
Next
        
End Sub

 

 

对所有的单元格格式化:

 

Sub format_string()
Dim m As String

For i = 1 To 60000
  For j = 1 To 28
    If Cells(i, j) <> "" Then
       m = Cells(i, j)
       Cells(i, j).Select
       Selection.NumberFormatLocal = "@"
       Cells(i, j) = m
    End If
  Next
   
Next

End Sub