Compile Error: = Expected After Function Call

Dec 18, 2006

i'm trying to call a function from another one, i'm getting this error 'Compiler error: = expected' but i don't know the reason, the functions simply take some values an store them in an here is the

Dim productos(19, 3) As String
Sub agregarProducto(ByVal descripcion As String, ByVal modelo As String, _
ByVal precio As String, ByVal unidad As String)
Dim r As Integer
For r = 0 To 19
If productos(r, 0) = "" Then
productos(r, 0) = descripcion
productos(r, 1) = modelo
productos(r, 2) = precio
productos(r, 3) = unidad
End If
Next
End Sub

Sub agregarProductoTelas()
Dim descripcion, modelo, precio, unidad As String
If Selection.Column = 1 Then
descripcion = Selection. Offset(0, 0).Value
modelo = Selection.Offset(0, 0).Value
precio = Selection.Offset(0, 3).Value
unidad = Selection.Offset(0, 2).Value
agregarProducto(descripcion, modelo, precio, unidad) 'error happens right here
MsgBox (descripcion)...

View 3 Replies


ADVERTISEMENT

Compile Error Expected Function Or Variable

Jul 27, 2006

Need the right direction to stop the error 'Compile Error Expected Function or Variable' appearing. I have both of the following codes in a module. The AddNewTenancy works perfectly but the EditTenancy comes up with the following error.
Both the Userforms exist so I know it's not that.

Sub EditTenancy()
EditTenancy.Show
End Sub
Sub AddNewTenancy()
NewTenancy.Show
End Sub

View 2 Replies View Related

Copy And Paste Special Values But Getting Error 'Compile Error - Expected Function Or Variable'

Feb 7, 2007

I am trying to run create a simple macro that copies and paste special values - something I have done 100's of times but for some reason I keep getting an error message - even though I recorded the macro and didnt write it by hand - see below:

Sub Macro6()
Cells.Select
selection.Copy
selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub

For which I get 'Compile Error - Expected Function or Variable'

View 6 Replies View Related

Shell Function Compile Error - Expected Procedure Not Variable

Aug 8, 2014

I have a VBA shell script that worked just fine on another computer, but now it won't run.

The code that won't execute is:

[Code] ........

View 12 Replies View Related

Compile Error Expected Line Number - End Statement

Apr 18, 2014

I am getting this error and where th If not starts its is in red showing that is where the issue is:

HTML Code: 

Sub RemoveRows()
Dim LR As Long, i As Long
Dim ws As Worksheet
Set ws = Worksheets("100 Airports")
LR = Range("B" & Rows.Count).End(xlUp).Row
For i = LR To 10 Step -1

[Code] .....

View 3 Replies View Related

Clear Contents Macro For Merge Cell (Compile Error - Expected End Sub)

Jun 13, 2014

I'm trying to use the "clear contents macro" for merge cell, but I keep receiving this "compile error : Expected End Sub" error.

FYI, I have named my merge cells to "myMergedCells"

[Code] .....

View 3 Replies View Related

Get Compile Error - Sub Or Function Not Defined?

Apr 9, 2014

Trring to use function edate() in VBA macro, I've activated atpvbaen.xls in Tools/Register but get compile error:"Sub or function not defined".

View 5 Replies View Related

Compile Error / Sub Or Function Not Defined

Jul 9, 2014

Have two worksheets in same workbook. First worksheet is "ReArrangedAddr" Which basically has a command button to click to run a "Sub" behind the second worksheet "Orig SH Register". When I click on button on first worksheet, I get error "Compile Error: Sub or Function not defined"

* * * * * code behind command button * * * * *

View 14 Replies View Related

Compile Error With Find Function

Mar 31, 2009

I am trying to use the Find function within some VBA code but keep encountering a compile error. Code works fine on it's own as below but doesn't work within the VBA code. I can't figure out what part of code needs to be modified.

The desired result in J2 = "Jim"

the value in cell I2 = "Jim |Anderson"

Working Function as follows:

View 3 Replies View Related

Compile Error / Sub Or Function Not Defined

May 17, 2012

I have a two set of Macros in a workbook. One is to create a command button on a sheet and other macro will run onece the created commond button is clicked.

Macro runs fine. Command button gets created, but when I click the command button to run another macro it gives error "Compile Error: Sub or Function not defined" highlighting the code "Call Add" at the code entered for sheet. This code is added by macro in the sheet1. I am attaching a sample file as well as codes.

Sub CreateButton()
Dim Obj As Object
Dim Code As String
Sheets("Sheet1").Select
'create button
Set Obj = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", _
Link:=False, DisplayAsIcon:=False, Left:=600, Top:=30, Width:=100, Height:=35)
Obj.Name = "InsertInvoiceButton"
'buttonn text

[code]....

View 9 Replies View Related

Compile Error - Only Comments May Appear After Sub End Function

Aug 13, 2013

Why do I get the below error when I open my workbook? The highlighted function is below.

Private Sub CommandButton1_Click()
Dim myText As Variant
If TextBox1.Value = "code" Then
UserForm1.Hide
Else
Me.Label1.Visible = True
Me.Label1.ForeColor = vbRed
End If
End Sub

View 1 Replies View Related

Compile Error: Sub Or Function Not Defined

Jul 28, 2006

Can someone explain the concept of defining the "Sub" to me.

View 5 Replies View Related

Defined Function - Compile Error Block If Without End If

Mar 17, 2014

I have created the following defined function in excel VBA but i get the complie error:-

'Block if without end if'

This this the code I have written for the function:-

Public Function Rule_45(Current, Previous, Result)
' RED: 'Decreasing Trend' OR 'Same' AMBER:'Increasing Trend' GREEN:'>83%'
If Result = "-" Then
Rule_45 = "-"

[Code].....

View 2 Replies View Related

Date Function Is Not Working - Compile Error

Dec 18, 2013

I developed a program which uses Date function in several places. Problem is that on some machine this function is not working and I'm getting compile error.

What is the reason for that. Is this a system setting??

View 9 Replies View Related

Function Parameters And Return - Compile Error

Jun 28, 2014

I have this code snippet..

Code:
Function appointment(ByVal day As String, ByVal hour As Integer) As String
' Insert code to return any appointment for the given day and time.
Return "appointment"
End Function

But I get this error. Compile error: Expected: end of statement

View 2 Replies View Related

Compile Error: Sub Or Function Not Defined - 3-line Macro

Jun 18, 2009

I'm trying to use MATCH to identify the Column number that contains "DL_Error", then I'll use this Column # to select a cell (found Column # & "34"), but I get the error shown in the title of this post.

Here's my current
Sub Macro15()
' Macro recorded 6/18/2009 by me
Range(Match("DL_ERROR", "A31:CW31", 0) & "34").Select
End Sub

View 9 Replies View Related

Microsoft Visual Basic: Compile Error: Sum Or Function Not Defined

Mar 24, 2006

I receive: "Microsoft Visual Basic Compile error:

Sum or Function not defined" after I have run a macro. I recorded the macro.

The macro code is: ..

View 12 Replies View Related

Excel 2007 :: Compile Error / Sub Or Function Not Defined - Even After Solver Has Been Referenced

May 15, 2014

I get this error : Compile error : Sub or Function not defined. I found out that this might be caused by the solver not being referenced. But, this is fixed now but I still get the same error message.

I'm using Excel 2007 - Windows.

Here is the code :

Sub Macro1()
Dim i As Integer
Dim j As Integer
j = 4
For i = 1 To 4000
If ActiveSheet.Cell(i, 12).Value = 1 Then
ActiveSheet.Cell(j, 15).Value = ActiveSheet.Cell(i, 2)

[code].....

View 2 Replies View Related

Date Function Returns Compile Error- Cant Find Project Or Library

Oct 1, 2006

I have the following

Private Sub Workbook_Open()
Worksheets("Sheet1"). Range("L5").Value = Date
End Sub

When i try and run the code it returns an error saying: "Compile Error, Cant Find Project Or Library" and it highlights the word "Date"

View 7 Replies View Related

Lookup Function Call: Vlookup Call In Sheet

May 21, 2006

I have a work book with 3 sheets. Sheet 1 is the main sheet and sheets 2 and 3 will use (I hope vlookup) to update 3 columns from info in sheet 1. my attempt at a vlookup call in sheet 2 is: =VLOOKUP($b3,[master_AoJ_2.xls]Sheet1!$B$3;$B$65,false)

my understanding is that: - $b3 is the cell in sheet 2 that will be updated as a result of the vlookup call. - [master_AoJ_2.xls]Sheet1!$B$3;$B$65 refers to range $B$3:$B$65 on sheet1 of master_AoJ_2. it does not work... infact I get nothing at all. when I type the call into cell $b3 of sheet2 excel thinks it is stariaght text. this is how I coded the function call =VLOOKUP($b3,[master_AoJ_2.xls]Sheet1!$B$3;$B$65,false)

View 4 Replies View Related

Expected End Of Statement Error

Jan 19, 2010

worksheets("Demorecords").Range("k2").formula = _
"=IF(AND(DAYS360(N2,Current_Date)>" & _
Combobox1.Text "!$B$6,DAYS360(N2,Current_Date)" & Combobox1.Text "!$B$7,"Pending Delete","Persistent"))"

A error box says compile error: expected end statement and then highlights this part (red)

View 9 Replies View Related

DMIN Function Not Working As Expected

Jan 7, 2008

I'm new to the DMIN function and I'm having a problem.

Cell A2: Date (rest of column is date format) (heading for the column)
Cell A2: Credit (rest of column is acctg. format) (heading for the column)
Cell A2: Debit (rest of column is acctg. format) (heading for the column)
Cell A2: Balance (rest of column is, equals balance field from previous row + credit - debit for current row, acctg. format) (heading for the column)
Column E: Notes (rest of column is generic text) (heading for the column)

Cell K1: Date (the text "Date")
Cell K2: > TODAY() (the text "> TODAY()") -- maybe this should be ="> TODAY()"?

Cell H2: =DMIN(A2:D1000,"Date",K1:K2)

I'm trying to get the minimum balance for the Balance column where the date is greater than today (lowest balance that I have in the future, which helps me see if I will be overdrafting).

I'm getting a value of 0 in H2. I have also tried =DMIN(A2:D1000,1,K1:K2) and get the same result.

View 9 Replies View Related

Vba Macro Error: Compile Error Named Argument Not Found

Apr 26, 2006

I have some code that, although works fine in Excel 2003, does not in Excel 1997. I receive this error when I try running it:

COMPILE ERROR:
NAMED ARGUMENT NOT FOUND

Sub HPVAL()
Dim r As Range, myStr As String
myStr = "HP"
Set r = Cells. Find(What:=myStr, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
If Not r Is Nothing Then
r = r.Value
While Not r Is Nothing
Set r = Cells.FindNext(r)
If Not r Is Nothing Then
r = r.Value
End If
Wend
End If
End Sub

It looks like Excel is getting hung up on the "SearchFormat:=" portion of the code.

View 2 Replies View Related

Solver: An Expected Internal Error Occurred, Or Available Memory Was Exhausted

Dec 29, 2006

I have a macro that does a solver routine. I have another macro that runs this solver, then copies and pastes new inputs, then runs the solver, then copies the results and pastes them somewhere, then copies new inputs, etc. It is a long process and it worked fine a few days ago. Now when I run it, about 90% of the way through and then excel crashes. The error says:

Solver: An expected internal error occurred, or available memory was exhausted.

What can I do?

View 9 Replies View Related

Error Message (Compile Error, Procedure Too Large)

May 20, 2009

I am looking for a more efficient way to write a macro (a sample from the macro is below). This is just the first part of the macro. I need to repeat these same steps (seen for row 5 below) for rows 5 to 50. My script worked until I hit row 35 and then I got the "compile error.." message. There must be a way to use "loop" to write this more efficiently, no?

View 14 Replies View Related

Cells.find Function Slower Than Expected Across Several Worksheets

Jan 24, 2007

I wrote a custom find function to search for a list of numbers across a bunch of worksheets (6 in total). A cell reference is sent to the function and it basically returns the worksheet name and address for the first occurence, or nothing if not found.

Now I realise that the number of cells that need to be checked is fairly severe across 6 worksheets (finding 65 numbers * 65536 * 256), but this still takes about 1 minute to execute... is that about right? Code was hacked together quickly and is nothing special...

Public Function My_Find(Optional my_range As Range) As String

Dim ws As Worksheet
Dim my_cell As Variant
Dim result As Variant

Application. ScreenUpdating = False
Application.Calculation = xlCalculationManual

View 3 Replies View Related

Compile Error Syntax Error In Macro

May 17, 2014

VB:
Selection.FormulaArray = _
"=IF(RC[-7]=""Weekly"",RC[-1],IF((ParentCode=RC[-10])*(ClassType=""Active""),IF((EndDate=EOMONTH(EndDate,0))*(RC[-7]
={""Monthly"",""Quarterly""}),RC[-1],0),IF(RC[-7]=""Daily"",IF(SUMPRODUCT(((ParentCode=RC[-10])*(FundType=""C"")*
(ClassType=""Inactive Class"")*(TermDate<>"""")*(TermDate>=StartDate)*(TermDate<=EndDate))+((ParentCode=RC[-10])*

[Code] .....

I recorded macro for this formula its giving me syntax error i did " _" after the break but its still not working..

View 4 Replies View Related

Macro: Compile Error - Syntax Error

Feb 1, 2010

"Compile error - Syntax Error"

and the following line highlighted in yellow

"Sub CreateWorkbooks()"

It worked on Excel 2000 but not now and dont work either in Excel 2007.

Heres the complete code .....

View 9 Replies View Related

Compile Error ...

May 4, 2008

Can some see why this Code would fail intermittently?

This gets executed after a Commandbutton is selected.

The Error Message is attached.

View 14 Replies View Related

Compile Error: For Without Next ..

Sep 14, 2009

I am using the following code to put a combo box in my userform. When I try to run it I get the following Compile Error: For without next. What does it mean and how do I fix it?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved