我试图在表的最后一行之前添加一行并隐藏最后一行。代码工作正常,包括隐藏表的最后一行。但不知道如何添加行。
Sub StayOverRoom2()
Dim lRow1 As Long
Dim lRow2 As Long
Dim eRow As Long
Dim Name1 As String
Dim Name2 As String
Dim Check As Boolean
Dim Table As ListObject
Dim nRow As ListRow
Dim lLastRow As Long
Dim strTableName As String
lRow1 = Sheets("DR01").Range("B" & Rows.Count).End(xlUp).Row
lRow2 = Sheets("DR02").Range("B" & Rows.Count).End(xlUp).Row
strTableName = "DailyReport2"
Set Table = Range(strTableName).ListObject
Sheets("DR02").Rows("1:150").EntireRow.Hidden = False
For i = 11 To lRow1
Name1 = Sheets("DR01").Cells(i, "C").Value
Check = False
For j = 11 To lRow2
Name2 = Sheets("DR02").Cells(j, "C").Value
If Sheets("DR01").Cells(i, 5) <= Date Or Name1 = Name2 Then
Check = True
End If
Next j
If Not Check Then
Set nRow = Table.ListRows.Add(AlwaysInsert:=True)
Sheets("DR01").Range(Sheets("DR01").Cells(i, "B"), Sheets("DR01").Cells(i, "E")).Copy
eRow = Sheets("DR02").Cells(Sheets("DR02").Rows.Count, 2).End(xlUp).Offset(1, 0).Row
nRow.Range(1, 1).PasteSpecial
nRow.Range(1, "E").Value = "S/O"
nRow.Range(1, "F").Value = "-"
nRow.Range(1, "G").Value = "-"
nRow.Range(1, "H").Value = "-"
nRow.Range(1, "I").Value = "-"
nRow.Range(1, "J").Value = "-"
nRow.Range(1, "K").Value = "-"
Sheets("DR01").Cells(i, "M").Copy
nRow.Range(1, "L").PasteSpecial
If Sheets("DR01").Cells(i, "M") = "R.D. - D" Or _
Sheets("DR01").Cells(i, "M") = "P.P.D. - D" Or _
Sheets("DR01").Cells(i, "M") = "C.R. - D" Then
nRow.Range(1, "L") = "Daily"
End If
If Sheets("DR01").Cells(i, "M") = "R.D. - W" Or _
Sheets("DR01").Cells(i, "M") = "P.P.D. - W" Or _
Sheets("DR01").Cells(i, "M") = "C.R. - W" Then
nRow.Range(1, "L") = "Weekly"
End If
Application.CutCopyMode = False
End If
Next i
lRow2 = Sheets("DR02").Range("B" & Rows.Count).End(xlUp).Row
Sheets("DR02").Rows(lRow2 & ":" & lRow2).EntireRow.Hidden = True
End Sub
我试图在表的最后一行之前添加一行并隐藏最后一行。代码工作正常,包括隐藏表的最后一行。但不知道如何添加行。
答案 0 :(得分:0)
使用记录宏工具找到
....some html code
<script>
window.location="example.php";
</script>