Active Cell.Row value

Posted on 2006-05-30
Last Modified: 2011-10-03
Anyone know how to collect the row number of an active cell? I have been trying to use "set n = ActiveCell.Row" but that does not seem to work. I am trying to set the "n" as a variable to be used elsewhere in the event.
Question by:pwanveer
    LVL 37

    Expert Comment

    by:Harisha M G
    Hi, remove "Set"

    LVL 37

    Accepted Solution

    n = ActiveCell.Row

    NOTE: Set is used to assign the objects. Since Row returns a Long, which is not an object, you should not use Set
    LVL 1

    Expert Comment

    run teh following sub
    u will get it..

    Sub test2()
       Dim i As Integer
       i = ActiveCell.Row

    End Sub


    Author Comment

    That's got it. Thank you!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now