008325
09-05-2007, 07:24 PM
i have a vba for writing a report. however , while i run it , it have a error.
Selection.EntireRow.Insert
and the error message is about the cell can not over 65535 row , and i found that there has one row on No. 65535 row. sothat it can not insert
Selection.Copy
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.EntireRow.Insert
ActiveSheet.Paste
is the above code has some problem ?
how can i solve this problem?
i upload the xls or sample data
pls help
If Right(ExcelPath, 14) = "Commission.txt" Then
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(9), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Range("C1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 6).Select
With Selection.Font
.Underline = xlUnderlineStyleDouble
End With
Selection.Font.Bold = True
ActiveCell.Offset(0, -1).Value = "Total :"
Selection.End(xlDown).Select
Selection.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
With Selection.Font
.Underline = xlUnderlineStyleDouble
End With
Selection.Font.Bold = True
ActiveCell.Offset(0, -1).Value = "Total :"
Rows("1").Select
Selection.Font.Bold = True
Selection.Font.Underline = xlUnderlineStyleSingle
Selection.Copy
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.EntireRow.Insert
ActiveSheet.Paste
Range("A1").Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Range("C1").Select
ActiveCell.FormulaR1C1 = "Date: "
Range("C3").Select
ActiveCell.FormulaR1C1 = "To: "
Range("C4").Select
ActiveCell.FormulaR1C1 = "Attn:"
Range("C5").Select
ActiveCell.FormulaR1C1 = "Ref:"
Range("C6").Select
ActiveCell.FormulaR1C1 = "Re: Your Commissions"
Range("C8").Select
ActiveCell.FormulaR1C1 = _
"1. Below please find the updated list of your commission:"
Range("A1").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
ActiveCell.Offset(3, 2).Select
ActiveCell.FormulaR1C1 = _
"2. Below please find the list of outstanding invoice which we have not receive payment:"
Columns("D:I").Select
Columns("D:I").EntireColumn.AutoFit
Columns("D:H").Select
With Selection
.HorizontalAlignment = xlCenter
End With
Columns("A:B").Select
Selection.EntireColumn.Hidden = True
Columns("G:G").Select
Selection.EntireColumn.Hidden = True
Range("C1").Select
End If
Selection.EntireRow.Insert
and the error message is about the cell can not over 65535 row , and i found that there has one row on No. 65535 row. sothat it can not insert
Selection.Copy
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.EntireRow.Insert
ActiveSheet.Paste
is the above code has some problem ?
how can i solve this problem?
i upload the xls or sample data
pls help
If Right(ExcelPath, 14) = "Commission.txt" Then
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(9), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Range("C1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 6).Select
With Selection.Font
.Underline = xlUnderlineStyleDouble
End With
Selection.Font.Bold = True
ActiveCell.Offset(0, -1).Value = "Total :"
Selection.End(xlDown).Select
Selection.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
With Selection.Font
.Underline = xlUnderlineStyleDouble
End With
Selection.Font.Bold = True
ActiveCell.Offset(0, -1).Value = "Total :"
Rows("1").Select
Selection.Font.Bold = True
Selection.Font.Underline = xlUnderlineStyleSingle
Selection.Copy
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.EntireRow.Insert
ActiveSheet.Paste
Range("A1").Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Range("C1").Select
ActiveCell.FormulaR1C1 = "Date: "
Range("C3").Select
ActiveCell.FormulaR1C1 = "To: "
Range("C4").Select
ActiveCell.FormulaR1C1 = "Attn:"
Range("C5").Select
ActiveCell.FormulaR1C1 = "Ref:"
Range("C6").Select
ActiveCell.FormulaR1C1 = "Re: Your Commissions"
Range("C8").Select
ActiveCell.FormulaR1C1 = _
"1. Below please find the updated list of your commission:"
Range("A1").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert
ActiveCell.Offset(3, 2).Select
ActiveCell.FormulaR1C1 = _
"2. Below please find the list of outstanding invoice which we have not receive payment:"
Columns("D:I").Select
Columns("D:I").EntireColumn.AutoFit
Columns("D:H").Select
With Selection
.HorizontalAlignment = xlCenter
End With
Columns("A:B").Select
Selection.EntireColumn.Hidden = True
Columns("G:G").Select
Selection.EntireColumn.Hidden = True
Range("C1").Select
End If