+ Reply to Thread
Results 1 to 6 of 6

How to setup the ROW number as a VARIABLE within a RANGE

  1. #1
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    How to setup the ROW number as a VARIABLE within a RANGE

    This is part of my code here:
    Please Login or Register  to view this content.

    I want the ROW NUMBER to be referenced as "xyz" in my code.
    But DEBUG error comes up and highlights THIS portion when the MACRO is run.
    Please Login or Register  to view this content.

    I think it's because THIS part is written wrong:
    Please Login or Register  to view this content.
    I don't know how to correct it!

    Thanks!

  2. #2
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: How to setup the ROW number as a VARIABLE within a RANGE

    hi,
    try one from below examples

    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    Best Regards
    MaczaQ
    ---------------------------------------------------------------------------------------------------------------------------
    If you are satisfied with the solution(s) provided, please mark your thread as Solved
    If you are pleased with my answer consider to rate it. To thank someone who has helped you, click on the star icon below their name.
    - This way you will add him some reputation points ... thanks in advance.

  3. #3
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to setup the ROW number as a VARIABLE within a RANGE

    Ok so I tried this:
    Please Login or Register  to view this content.
    And it brings a DEBUG error and highlights: Set ord = Intersect(.Rows(xyz), .Range("AA:AF"))


    I also tried this:
    Please Login or Register  to view this content.
    And in the DEBUG error it highlights this: Set ord = Sheets("Image Catalog").Range("AA" & xyz & ":AF" & xyz)


    I don't get it... what's wrong?

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How to setup the ROW number as a VARIABLE within a RANGE

    explain better what do you want, attach a sample

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How to setup the ROW number as a VARIABLE within a RANGE

    Some of your declaration types are wrong,

    Try

    Please Login or Register  to view this content.
    or an alternative would be

    Please Login or Register  to view this content.
    Last edited by jason.b75; 08-13-2012 at 06:47 AM.

  6. #6
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to setup the ROW number as a VARIABLE within a RANGE

    OK I figured it out....

    I got it to work this way (referencing the row number to a cell "AD1") Which is an even better solution for my project !!
    Please Login or Register  to view this content.
    AND the "AD1" has a MATCH formula looking for the product id and identifying what row it's in:
    Please Login or Register  to view this content.
    So looks like your code was fine! The problem was in the original: Set xyz = Rows(13)
    That's what it didn't like.


    Thanks for your help!!
    The important thing is it works great now!
    Last edited by nenadmail; 08-13-2012 at 06:53 AM.

+ 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