Results 1 to 9 of 9

Run-time error 1004 - Application-defined or object-defined error

Threaded View

  1. #1
    Registered User
    Join Date
    10-28-2008
    Location
    Romania
    Posts
    3

    Run-time error 1004 - Application-defined or object-defined error

    Hi All,

    This is my very first VBA project, and I'm a bit lost. I've got this run-time error:
    1004 - Application-defined or object-defined error.

    Could you please take a look into the program and suggest me where could the problem be?
    Sub FormatTable()
    Dim i As Long
    Dim rng As Range
    Dim celle As Range
    
    Set rng = Range(Sheets("Sheet1").[A1], Sheets("Sheet1").[A65536].End(xlUp))
    
    
    For Each celle In rng
      If IsEmpty(celle.value) and IsEmpty(celle.Offset(1, 0)) and IsEmpty(celle.Offset(2, 0)) and IsEmpty(celle.Offset(3, 0)) Then   
           celle.select
         Range("A1:H2").Select
         Selection.Copy
         Range("celle.offset(1,0)").Select
         ActiveSheet.Paste
           Range("celle.offset(-1,0)").Select
           Selection.Font.bold = True
        Range("celle.offset(5,0)").Select
        Selection.CurrentRegion.Select
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlInsideHorizontal)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
      end if
    next celle
    
    end sub
    Thank you so much:-)
    beacska
    Last edited by Leith Ross; 10-28-2008 at 08:27 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1