Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compile Error:Expected Array | Excel Programming | |||
Compile Error: Expected Array | Excel Programming | |||
compile error - expected an array | Excel Programming | |||
compile error: Expected: = ...Why? | Excel Programming | |||
Compile Error: Expected End Property | Excel Programming |