+ Reply to Thread
Results 1 to 4 of 4

Object does not support this property or method

  1. #1
    Registered User
    Join Date
    12-18-2007
    Posts
    3

    Object does not support this property or method

    Hi Guys,

    I am getting this error "Object doesnot support this property or method"

    What i'm tryin to do is, i have a data dump from SQl...
    I want to compare some values from Sheet2 and then based on the result either look in some other cell in Sheet2 or return the value back to Sheet3.

    The 0/1/1900 is the date that SQL is returning back to the excel file (that field in SQL is null)...

    I want to run this code as a macro.. what am i doing wrong???


    Please Login or Register  to view this content.
    Last edited by VBA Noob; 12-18-2007 at 04:32 AM.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Welcome.

    Please wrap your code.
    Your code would be much easier to read.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Not sure if this is the problem, but I don't think any of your cells actually equal 0/1/1900. The Excel interpretation of the number zero in a cell formatted as date would be 0/1/1900 (or 1/0/1900 in U.S. English versions of Excel).

    Perhaps the SQL field you're getting your data from is a date field, but it is empty and returning a 0 instead of a null value? I'm not an expert in SQL by any means, but it seems logical.

    Try testing for 0 instead of 0/1/1900, like so..
    Please Login or Register  to view this content.
    UPDATE: Upon further review, you're using quotes around the first instance of Range("Sheet2!..."), but you don't use quotes for any of the other ranges. Try adding the quotes to each of the Range statements as shown in red above.
    Last edited by Paul; 12-18-2007 at 02:34 AM.

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Sheesh. Upon even further review, I'd recommend using the following code format:
    Please Login or Register  to view this content.
    Instead of using Range("Sheet2!CW6"), explicity define the Sheet name. You only have to type it once when using a With/End With block, and .'s before each Range (otherwise you'd have to constantly type Sheets("Sheet2").Range("N6").Value....

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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