Consulting

Results 1 to 3 of 3

Thread: Excel Bug Fix

  1. #1

    Excel Bug Fix

    i have a vba for writing a report. however , while i run it , it have a error.

    [VBA]Selection.EntireRow.Insert[/VBA]


    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

    [VBA]
    Selection.Copy
    Selection.End(xlDown).Select
    Selection.End(xlDown).Select
    Selection.EntireRow.Insert
    ActiveSheet.Paste
    [/VBA]

    is the above code has some problem ?

    how can i solve this problem?

    i upload the xls or sample data

    pls help

    [VBA]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
    [/VBA]

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Why is there data on Row 65535?
    Can't you delete it?

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Formats such as borders and coloured cell are sometimes seen as "data" preventing insertion of lines/columns
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •