Results 1 to 3 of 3
  1. #1
    selvakumar.arc is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    49

    Find last used column address using vba

    Hi All,


    I am trying to find last used column address from an excel sheet, but I am not getting proper cell address. I am using MS Access 2003 and please find following code snippet that I used for finding the last column.

    (ColumnFound - used with "cells.find" to get particular row position from the sheet.)

    Range(ColumnFound.AddressLocal).Select
    Do Until IsEmpty(ActiveCell)
    ActiveCell.Offset(0, 1).Select
    Loop

    Msgbox(ActiveCell.AddressLocal)

    I have around 30 sheets in a workbook, some sheets this code is working correct but some sheets it giving wrong result. I am not sure what wrong with code/excel sheet. Please anyone help me to solve this issue.

    Regards,
    Selvakumar R

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Want to provide the workbook for analysis?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    selvakumar.arc is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    49
    This problem got solved. When reading each sheet I activated that sheet so I am getting last used column correctly. Thanks for support.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to find Country by using the email address?
    By jamesfranklin in forum Programming
    Replies: 2
    Last Post: 03-07-2013, 07:07 AM
  2. Problem while import IP Address column
    By stal in forum Import/Export Data
    Replies: 1
    Last Post: 05-21-2012, 07:16 AM
  3. find out values between two dates column
    By learning_graccess in forum Queries
    Replies: 3
    Last Post: 04-20-2012, 04:17 AM
  4. Replies: 1
    Last Post: 01-22-2010, 03:21 AM
  5. Input Mask for an IP Address and Mack Address
    By baksg1995 in forum Access
    Replies: 18
    Last Post: 06-23-2009, 12:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums