compile error?

L

leonidas

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
 
N

Norman Jones

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
'<<=============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top