Excel 代码编写 统一去掉单元格左上角的三角符号

xiaoxiao2021-02-28  199

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) //监听单元格的双击事件     If Target.Column = 8 Then //如果点击的是是第8列         Dim i As Integer  // i 为整型         For i = 1 To 455 //循环语句 从 1到455              Cells(i, 8).Value = Cells(i, 8).Value //单元格(行,列)的值 = 单元格(行,列)的值。此处主要是为了把字符串格式转为数值格式。运行前将此列单元格设置为数值。         Next     End If

End Sub

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)             If Target.Column = 1 Then         Dim j As Integer         For j = 3 To 155             If Cells(j, 1).Value = "" Then                 Cells(j, 1).Value = Cells(j - 1, 1).Value // 让后一行单元格等于上一行单元格的值              End If         Next     End If                If Target.Column = 4 Then         Dim i As Integer         For i = 1 To 155              Cells(i, 4).Value = Cells(i, 4).Value         Next     End If End Sub

此代码执行结果就是将单元格左上角的三角符号去掉(在设置单元格为数值不起作用的时候)。

打开代码编辑器快捷键 ALT+F11

转载请注明原文地址: https://www.6miu.com/read-41173.html

最新回复(0)