+ Reply to Thread
Results 1 to 8 of 8

VBA code - query using cell reference for greater than

  1. #1
    Registered User
    Join Date
    10-27-2010
    Location
    Swansea, Wales
    MS-Off Ver
    Excel 2007
    Posts
    47

    VBA code - query using cell reference for greater than

    Hi all,

    Have tried using the following code (extract only):

    Please Login or Register  to view this content.
    Basically, it doesn't like the cell references for the greater than less than bit - anyone know how to correctly word this query?

    Bit new to all this!

    Thanks.

  2. #2
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: VBA code - query using cell reference for greater than

    Hi,

    If you've copied the line in here, then maby it's this part

    Please Login or Register  to view this content.
    Try inserting a space between & and the rest.
    Furthermore, you need to exit string when referencing a cell.

    Example
    Please Login or Register  to view this content.
    Last edited by Steffen Thomsen; 11-20-2011 at 12:05 PM.
    Please take time to read the forum rules

  3. #3
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: VBA code - query using cell reference for greater than

    Also put a space in
    Please Login or Register  to view this content.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: VBA code - query using cell reference for greater than

    duplicate post

  5. #5
    Registered User
    Join Date
    10-27-2010
    Location
    Swansea, Wales
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA code - query using cell reference for greater than

    Please Login or Register  to view this content.
    Thanks for the replies guys. Have tried adding the spaces and playing around with this in general as per foxguy's posts but I just can't seem to get it to work! I think I'm missing something?

    Above is an extract of the query when I record a macro in excel but I've tried inserting cell references instead of the absolute numbers.

    Apologies is this is a duplicate foxguy - Have I asked the same question before?

  6. #6
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: VBA code - query using cell reference for greater than

    Quote Originally Posted by swanseaexcel View Post
    Apologies is this is a duplicate foxguy - Have I asked the same question before?
    I was the one that had a duplicate post. My computer really slowed down and I didn't think i had hit "Submit", so I hit it again.

  7. #7
    Registered User
    Join Date
    10-27-2010
    Location
    Swansea, Wales
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA code - query using cell reference for greater than

    Ah ok! Any idea on where I'm going wrong with this? Am tearing my hair out as I've tried tweaking plenty of things but I keep getting an error. I know it's only a space or a character that's wrong too!

    Thanks!

  8. #8
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: VBA code - query using cell reference for greater than

    Please Login or Register  to view this content.
    As written in my previous post, you have to exit the strin when referencing the cells and then go into the string again when continuing the query

+ 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