Set is a very efficient and fast way to reference the various objects in Excel. I see you've defined 'comment' as a Variant, and in the code you retrieve a value from a worksheet using VLOOKUP all well and good..I am working on VBA code in excel and i have the following piece of code Set strModel = Right rng.Offset , .Value, Len rng.Offset , .Value When I run the code I get a compile error to. preface Man, I kinda hate VBA! preface Easier than I thought when you use For Each, it seems that VBA does a bit of a cast of the loop variable type according to what is actually being used as the set it will loop over..For all general questions relating to Excel but not including VBA or formulas..In this Excel VBA Macro Tutorial we create the runtime Object Required Error. The error is caused by your code referencing a property or method but it .Sub Split Dim wb As String Dim ws As String wb = ActiveWorkbook.Name ws = ActiveSheet.Name Vcolumn = InputBox Please indicate which column i.e. A,.Hi There, I am new to VBA, I have tried to write the code below. However, it says object required. I am new, but I thought I had everything in place..Disclaimer I am new to VBA. I'm just looking up code on it internet, trying to piece it together and make it work. I am teaching myself through failu.Specify an object qualifier if you didn't provide one. For example, although you can omit an object qualifier when referencing a form property from within the form's own module, you must explicitly specify the qualifier when referencing the property from a standard module. You supplied an object qualifier, but it isn't recognized as an object..
The first code line, Option Explicit means in simple terms that all of your variables have to be explicitly declared by Dim statements. They can be any type, including object, integer, string, or even a variant. This line Dim envFrmwrkPath As Range is declaring the variable envFrmwrkPath of type Range.This means that you can only set it to a range..The Set statement is only used for object variables like Range, Cell or Worksheet in Excel , while the simple equal sign '=' is used for elementary datatypes like Integer.You can find a good explanation for when to use set here The other problem is, that your variable gval isn't actually declared as Integer, but has the type Variant.This is ."The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing..The Object Browser enables you to see a list of all the different objects with their methods, properties, events and constants. In the VBE editor ..Download Full Image