这个excel的宏代码VBA怎么改成让A-M,O-Q都能用?
答案:1 悬赏:60 手机版
解决时间 2021-03-27 01:54
- 提问者网友:献世佛
- 2021-03-26 17:45
这个excel的宏代码VBA怎么改成让A-M,O-Q都能用?
最佳答案
- 五星知识达人网友:雾月
- 2021-03-26 18:33
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
For j = 1 To 17
if j<>14 then
str1 = ""
For i = 1 To Cells(Rows.Count, j).End(3).Row
If Len(Cells(i, j)) > 0 Then
str1 = Cells(i, j)
Else
Cells(i, j) = str1
End If
Next i
Next j
end if
Application.ScreenUpdating = True
End Sub追问编译错误
next 没有for追答Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
For j = 1 To 17
if j<>14 then
str1 = ""
For i = 1 To Cells(Rows.Count, j).End(3).Row
If Len(Cells(i, j)) > 0 Then
str1 = Cells(i, j)
Else
Cells(i, j) = str1
End If
Next i
end if
Next j
Application.ScreenUpdating = True
End Sub追问QQ,,540119878 为什么你改完之后 一行都没用了。。 。。?追答Sub xxx()
For i = 5 To [n65536].End(xlUp).Row
For j = 1 To 17
If Cells(i, j).MergeCells = True And Cells(i, j).MergeArea.Cells(1, 1) = "" Then
Cells(i, j).MergeArea.Cells(1, 1) = Cells(i, j).End(xlUp)
End If
Next
Next
End Sub
Application.ScreenUpdating = False
For j = 1 To 17
if j<>14 then
str1 = ""
For i = 1 To Cells(Rows.Count, j).End(3).Row
If Len(Cells(i, j)) > 0 Then
str1 = Cells(i, j)
Else
Cells(i, j) = str1
End If
Next i
Next j
end if
Application.ScreenUpdating = True
End Sub追问编译错误
next 没有for追答Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
For j = 1 To 17
if j<>14 then
str1 = ""
For i = 1 To Cells(Rows.Count, j).End(3).Row
If Len(Cells(i, j)) > 0 Then
str1 = Cells(i, j)
Else
Cells(i, j) = str1
End If
Next i
end if
Next j
Application.ScreenUpdating = True
End Sub追问QQ,,540119878 为什么你改完之后 一行都没用了。。 。。?追答Sub xxx()
For i = 5 To [n65536].End(xlUp).Row
For j = 1 To 17
If Cells(i, j).MergeCells = True And Cells(i, j).MergeArea.Cells(1, 1) = "" Then
Cells(i, j).MergeArea.Cells(1, 1) = Cells(i, j).End(xlUp)
End If
Next
Next
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯