Solved

in VB how to know the last record of an excel spreadsheet?

Posted on 2004-10-21
133 Views
Last Modified: 2010-05-02
i have an spreadsheet that has 3 columns and the data in every field is populated every month, so always the amount of data may varies.

for example, some months i can have from cell a1 to cell c32, and in other months i can have from cell a1 to cell c43

i need to know the final cell, in this example, c43.

additional.

i always have 3 columns, A, B and C.

thanks a lot.

matt
0
Question by:matthews_30
    3 Comments
     
    LVL 24

    Expert Comment

    by:R_Rajesh
    Hi matthews_30,
    try this:

    Range("C65536").End(xlUp).Address(0, 0)

    Rajesh
    0
     
    LVL 24

    Accepted Solution

    by:
    0
     
    LVL 26

    Expert Comment

    by:EDDYKT
    ActiveSheet.Range("a1").SpecialCells(xlCellTypeLastCell).Column ' last cell on a column
    ActiveSheet.Range("c1").SpecialCells(xlCellTypeLastCell).Row  ' last cell on c row
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    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…

    913 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

    12 Experts available now in Live!

    Get 1:1 Help Now