Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default Compile Error: Expected:(

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Compile Error: Expected:(

Are you sure it is that macro, not another one?

HTH

Bob

"Squeaky" wrote in message
...
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default Compile Error: Expected:(

100% sure.

I even looked at the button I have tied to the macro to make sure.

"Bob Phillips" wrote:

Are you sure it is that macro, not another one?

HTH

Bob

"Squeaky" wrote in message
...
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




.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Compile Error: Expected:(

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.



Squeaky wrote:

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


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default Compile Error: Expected:(

That was it. Perfect!

Thanks,

Squeaky

"Dave Peterson" wrote:

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.



Squeaky wrote:

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


--

Dave Peterson
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile Error:Expected Array Fatima CN Excel Programming 2 October 15th 09 03:23 AM
Compile Error: Expected Array BEEJAY Excel Programming 7 December 8th 08 08:23 PM
compile error - expected an array John Excel Programming 8 September 21st 06 08:04 PM
compile error: Expected: = ...Why? cesw[_2_] Excel Programming 3 September 10th 05 12:41 AM
Compile Error: Expected End Property George J[_3_] Excel Programming 4 August 3rd 05 03:35 PM


All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"