+ Reply to Thread
Results 1 to 1 of 1

Defined SheetValue as Variant, but it still says object required?

  1. #1
    Registered User
    Join Date
    12-03-2014
    Location
    London
    MS-Off Ver
    MS office 2010
    Posts
    18

    Defined SheetValue as Variant, but it still says object required?

    Hi Guys

    (Problem solved, thanks for your time!)

    I'm trying to process a table so that I can create a cvs file...

    Data:
    The data I have looks like this... where username either has or has no access to that system.

    ....................System1......System2... System3
    Username1.....Yes.............No............No
    Username2.....Yes.............Yes...........No
    Username3.....Yes.............No............Yes

    VBA Error:
    The error I'm having is "Object required" for SheetValues in the line highlighted in the code (which I defined as variant). Please note that the first line of the code below works fine and the data is loaded correctly. I can view it in my watch console.

    This is what my code looks like

    Please Login or Register  to view this content.
    Is the error occuring because I'm trying to invoke Value from a variant object? If so, how do I correct this?


    **************************************************

    oh, after an hour of trial and error, I figured this out...

    I changed the SheetValues to Range instread of Variant... then I used the keyword Set to set the values and removed .values from the first line above...

    Please Login or Register  to view this content.
    Now the file is created, but it is a hotmess :D .. I will still need to play with the code to make it do what I want...

    If anyone has any suggestions to make the code cleaner... I'm happy to read your suggestions!

    Thanks
    Dan
    Last edited by malleat1; 01-03-2015 at 10:18 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. For each control variable must be variant or object?
    By bjcowen9000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2013, 04:27 PM
  2. [SOLVED] Run Time 1004 - App Defined or Object defined error with String defined path structure
    By sarails in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-11-2012, 09:38 PM
  3. Refer to array elements defined as Variant
    By hareleph in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-23-2011, 07:15 AM
  4. Call function must return variant or object
    By BCITgirl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2010, 03:23 AM
  5. [SOLVED] is a variant an object
    By James Cornthwaite in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-09-2006, 06:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1