Compile Error: Expected:(

S

Squeaky

I have a macro that works fine in my workbook, yet when I go into VBA and try
to run it there (using F5 or stepping into it with F8 I get the error. All of
the other macros in theis workbook work fine from VBA.

Any ideas?

Here is the macro:

Sub Line()
'
' Line Macro


'

ActiveSheet.Unprotect Password:=""

If Intersect(ActiveCell, Range("range1")) Is Nothing Then

Range("RANGE1.1").Select
Do
If IsEmpty(ActiveCell) = True Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = False
ActiveCell.Offset(-1, 1).Select
ActualRow = Selection.Row
Cells(ActualRow + 1, 1).EntireRow.Insert
Range(Cells(ActualRow, 1), Cells(ActualRow, 33)).Copy _
Destination:=Cells(ActualRow + 1, 1)

Else
ActualRow = Selection.Row
Cells(ActualRow + 1, 1).EntireRow.Insert
Range(Cells(ActualRow, 1), Cells(ActualRow, 33)).Copy _
Destination:=Cells(ActualRow + 1, 1)

End If

ActiveSheet.Protect Password:="", DrawingObjects:=True, Contents:=True,
Scenarios:=True
Range("RANGE1.1").Select

End Sub
 
D

Dave Peterson

Don't use Line as the name of the sub.

Sub myLine()

is ok.

I try to stay away from using any VBA keyword as a variable, procedure, module
name.
 
S

Squeaky

That was it. Perfect!

Thanks,

Squeaky

Dave Peterson said:
Don't use Line as the name of the sub.

Sub myLine()

is ok.

I try to stay away from using any VBA keyword as a variable, procedure, module
name.
 

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