VBA Excel “Compile error: Object Required”

I am working on VBA code in excel and i have the following piece of code When I run the code I get a compile error to debug and it reads Object Required. What is it asking me to do? This is a larger piece of the code:

Average in VBA in Excel

Look closely at what you’re trying to do in this code: You’re assigning a “long” value to each of l and m and then calling them in the average function as if they were references to a cell. I suggest that you add a range variable, assign the location of the data you want to … Read more

‘Cannot find DAO350.dll’ file error VB6

The DA0350.dll must be registered. Try this: On the Visual Basic 6.0 CD (or whatever your installation source is), locate the Dao350.dll file, and then copy it to the directory c:\program files\common files\microsoft shared\DAO. (The Dao350.dll file is located in the \os\system folder on the Visual Basic 6.0 CD.) To register this file, click Start, … Read more

What is the difference between “Form Controls” and “ActiveX Control” in Excel 2010?

Google is full of information on this. As Hans Passant said, Form controls are built in to Excel whereas ActiveX controls are loaded separately. Generally you’ll use Forms controls, they’re simpler. ActiveX controls allow for more flexible design and should be used when the job just can’t be done with a basic Forms control. Many user’s computers by default won’t trust ActiveX, and it will be disabled; … Read more

Compare Dates in VBA

Here’s how you can fix your code. Of course it’s not the best way to do date calculations, and you’ll also have to validate that there is text in the 2 text boxes, and maybe even use CDate() to parse the text to date values, but this will work for your current situation.