+ Reply to Thread
Results 1 to 5 of 5

compile error?

  1. #1
    Registered User
    Join Date
    06-13-2006
    Posts
    76

    compile error?

    Hi,

    I have the following macro in VBE, but by running it an error occurs. It is a compile error and the problem is the range with named ranges in it.
    Does someone have a solution? Thanks in advance!

    Sub RijInvoegen()

    If Intersect(ActiveCell, Range("ToegestaneRijenOnderbouw", "ToegestaneRijenSkelet", _
    "ToegestaneRijenGevelDakPrefab", "ToegestaneRijenDiversen")) Is Nothing Then
    MsgBox "U kunt hier geen rij invoegen"
    Else
    Call InvoegenRij
    End If

    End Sub
    ------------------------------------------------------------------------
    Private Sub InvoegenRij()

    Application.ScreenUpdating = False
    ActiveCell.Offset(1, 0).EntireRow.Insert
    ActiveCell.EntireRow.Copy ActiveCell.Offset(1, 0).EntireRow
    Selection.Offset(1).EntireRow.SpecialCells(xlConstants).ClearContents

    End Sub

  2. #2
    Norman Jones
    Guest

    Re: compile error?

    Hi Leonidas,

    Try:

    '=============>>
    Public Sub RijInvoegen()
    If Intersect(ActiveCell, _
    Union(Range("ToegestaneRijenOnderbouw"), _
    Range("ToegestaneRijenSkelet"), _
    Range("ToegestaneRijenGevelDakPrefab"), _
    Range("ToegestaneRijenDiversen"))) Is Nothing Then
    MsgBox "U kunt hier geen rij invoegen"
    Else
    Call InvoegenRij
    End If
    End Sub
    '<<=============


    ---
    Regards,
    Norman



    "leonidas" <leonidas.29szjn_1150979105.0085@excelforum-nospam.com> wrote in
    message news:leonidas.29szjn_1150979105.0085@excelforum-nospam.com...
    >
    > Hi,
    >
    > I have the following macro in VBE, but by running it an error occurs.
    > It is a compile error and the problem is the range with named ranges in
    > it.
    > Does someone have a solution? Thanks in advance!
    >
    > Sub RijInvoegen()
    >
    > If Intersect(ActiveCell, Range("ToegestaneRijenOnderbouw",
    > "ToegestaneRijenSkelet", _
    > "ToegestaneRijenGevelDakPrefab", "ToegestaneRijenDiversen")) Is
    > Nothing Then
    > MsgBox "U kunt hier geen rij invoegen"
    > Else
    > Call InvoegenRij
    > End If
    >
    > End Sub
    > ------------------------------------------------------------------------
    > Private Sub InvoegenRij()
    >
    > Application.ScreenUpdating = False
    > ActiveCell.Offset(1, 0).EntireRow.Insert
    > ActiveCell.EntireRow.Copy ActiveCell.Offset(1, 0).EntireRow
    >
    > Selection.Offset(1).EntireRow.SpecialCells(xlConstants).ClearContents
    >
    > End Sub
    >
    >
    > --
    > leonidas
    > ------------------------------------------------------------------------
    > leonidas's Profile:
    > http://www.excelforum.com/member.php...o&userid=35375
    > View this thread: http://www.excelforum.com/showthread...hreadid=554506
    >




  3. #3
    Norman Jones
    Guest

    Re: compile error?

    Hi Leonidas,

    Try:

    '=============>>
    Public Sub RijInvoegen()
    If Intersect(ActiveCell, _
    Union(Range("ToegestaneRijenOnderbouw"), _
    Range("ToegestaneRijenSkelet"), _
    Range("ToegestaneRijenGevelDakPrefab"), _
    Range("ToegestaneRijenDiversen"))) Is Nothing Then
    MsgBox "U kunt hier geen rij invoegen"
    Else
    Call InvoegenRij
    End If
    End Sub
    '<<=============


    ---
    Regards,
    Norman



    "leonidas" <leonidas.29szjn_1150979105.0085@excelforum-nospam.com> wrote in
    message news:leonidas.29szjn_1150979105.0085@excelforum-nospam.com...
    >
    > Hi,
    >
    > I have the following macro in VBE, but by running it an error occurs.
    > It is a compile error and the problem is the range with named ranges in
    > it.
    > Does someone have a solution? Thanks in advance!
    >
    > Sub RijInvoegen()
    >
    > If Intersect(ActiveCell, Range("ToegestaneRijenOnderbouw",
    > "ToegestaneRijenSkelet", _
    > "ToegestaneRijenGevelDakPrefab", "ToegestaneRijenDiversen")) Is
    > Nothing Then
    > MsgBox "U kunt hier geen rij invoegen"
    > Else
    > Call InvoegenRij
    > End If
    >
    > End Sub
    > ------------------------------------------------------------------------
    > Private Sub InvoegenRij()
    >
    > Application.ScreenUpdating = False
    > ActiveCell.Offset(1, 0).EntireRow.Insert
    > ActiveCell.EntireRow.Copy ActiveCell.Offset(1, 0).EntireRow
    >
    > Selection.Offset(1).EntireRow.SpecialCells(xlConstants).ClearContents
    >
    > End Sub
    >
    >
    > --
    > leonidas
    > ------------------------------------------------------------------------
    > leonidas's Profile:
    > http://www.excelforum.com/member.php...o&userid=35375
    > View this thread: http://www.excelforum.com/showthread...hreadid=554506
    >




  4. #4
    Norman Jones
    Guest

    Re: compile error?

    Hi Leonidas,

    Try:

    '=============>>
    Public Sub RijInvoegen()
    If Intersect(ActiveCell, _
    Union(Range("ToegestaneRijenOnderbouw"), _
    Range("ToegestaneRijenSkelet"), _
    Range("ToegestaneRijenGevelDakPrefab"), _
    Range("ToegestaneRijenDiversen"))) Is Nothing Then
    MsgBox "U kunt hier geen rij invoegen"
    Else
    Call InvoegenRij
    End If
    End Sub
    '<<=============


    ---
    Regards,
    Norman



    "leonidas" <leonidas.29szjn_1150979105.0085@excelforum-nospam.com> wrote in
    message news:leonidas.29szjn_1150979105.0085@excelforum-nospam.com...
    >
    > Hi,
    >
    > I have the following macro in VBE, but by running it an error occurs.
    > It is a compile error and the problem is the range with named ranges in
    > it.
    > Does someone have a solution? Thanks in advance!
    >
    > Sub RijInvoegen()
    >
    > If Intersect(ActiveCell, Range("ToegestaneRijenOnderbouw",
    > "ToegestaneRijenSkelet", _
    > "ToegestaneRijenGevelDakPrefab", "ToegestaneRijenDiversen")) Is
    > Nothing Then
    > MsgBox "U kunt hier geen rij invoegen"
    > Else
    > Call InvoegenRij
    > End If
    >
    > End Sub
    > ------------------------------------------------------------------------
    > Private Sub InvoegenRij()
    >
    > Application.ScreenUpdating = False
    > ActiveCell.Offset(1, 0).EntireRow.Insert
    > ActiveCell.EntireRow.Copy ActiveCell.Offset(1, 0).EntireRow
    >
    > Selection.Offset(1).EntireRow.SpecialCells(xlConstants).ClearContents
    >
    > End Sub
    >
    >
    > --
    > leonidas
    > ------------------------------------------------------------------------
    > leonidas's Profile:
    > http://www.excelforum.com/member.php...o&userid=35375
    > View this thread: http://www.excelforum.com/showthread...hreadid=554506
    >




  5. #5
    Registered User
    Join Date
    06-13-2006
    Posts
    76

    Compile error solved!

    Hi Norman,

    Thanks for your help! It works perfect now!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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