Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Dec 2001
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    correct syntax (excel 97+)

    I have the following:
    lastrow1 = Range("A65536").End(xlUp).Row ' Watch gives value 182 which is correct
    toprow = Range("A" & (lastrow1)).End(xlUp).Row 'Watch gives value 28 which is correct

    Range("a28: a" & (lastrow1)).Select ' selects cells a28 to a182

    Range("a & (toprow) : a" & (lastrow1)).Select ' gives an error---whats wrong???
    CAN U GIVE ME THE CORRECT PUNCTUATION
    THANX
    SMBS

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: correct syntax (excel 97+)

    Try:

    <pre> Range("a" & toprow & " : a" & lastrow1).Select
    </pre>

    Legare Coleman

  3. #3
    2 Star Lounger
    Join Date
    Dec 2001
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: correct syntax (excel 97+)

    Works like a bomb --Thanx
    Where can I find more about the syntax logic???---
    any recommendations???
    Thanx
    Smbs

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: correct syntax (excel 97+)

    If you don't find it in the Help files, then here is about as good as anyplace I have found.
    Legare Coleman

  5. #5
    2 Star Lounger
    Join Date
    Dec 2001
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: correct syntax (excel 97+)

    Thanx to people like u---U r 100% correct!!!
    Keep the great work up!
    Thanx
    Smbs

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: correct syntax (excel 97+)

    Learning VBA syntax has been a thorn in my side, but you will generally find that VBA string concatenation follows nearly all the same rules as Excel spreadsheet concatenation ... if you know those rules ... plus you have the addition of vbLF & vbTab Constants to make the code easier to write and understand.
    -John ... I float in liquid gardens
    UTC -7ąDS

  7. #7
    2 Star Lounger
    Join Date
    Dec 2001
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: correct syntax (excel 97+)

    thanx-- got the message
    Smbs

Posting Permissions

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