Excel VBA - Worksheet Function Syntax in VBA

Posted on 2012-09-07
Medium Priority
Last Modified: 2012-09-26
Sheets(a.Name).Range("T2").Offset(is + 2, 0).Value = "=Sumif(T" & 2 & ":" & "T" & is + 1 & "," & " '<0'" & ",D" & 2 & ":" & "D" & is + 1 & ")"  

I get the application error on excel when I try to write the worksheet function in vba. The highlighted place is the <0 part which should be like "<" .

Question by:awesomejohn19
1 Comment
LVL 39

Accepted Solution

nutsch earned 2000 total points
ID: 38378328
you cannot use is as a variable, use somethingelse instead
a.range("T2").Offset(somethingelse + 2, 0).Formula = "=Sumif(T2:T" & somethingelse + 1 & ",'<0',D2:D" & somethingelse + 1 & ")"

Open in new window


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question