+ Reply to Thread
Results 1 to 3 of 3

Using VBA how do I return the column number of first column in a user inputted range?

  1. #1
    Registered User
    Join Date
    01-26-2009
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Using VBA how do I return the column number of first column in a user inputted range?

    Hello,

    I'm creating a macro that creates a co-ocurrence matrix from variables that are adjacent to each other.

    In order to proceed, I need to know how to return the column number of the first (leftmost) column in a range that the user selects.

    How I obtain the range:
    Please Login or Register  to view this content.
    Any help or direction would be appreciated. Questions are more than welcome, often times my posts are unclear.

    Thanks!
    Last edited by NukedWhale; 02-19-2009 at 06:24 PM.

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: Using VBA how do I return the column number of first column in a user inputted ra

    Hi

    Just call Column on the range variable - it will return the column number of the first column in the range:

    Please Login or Register  to view this content.
    Richard

    EDIT: note this will potentially fail to return the left-most column if the range contains multiple areas
    Last edited by Richard Schollar; 02-19-2009 at 05:00 PM.
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    01-26-2009
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Using VBA how do I return the column number of first column in a user inputted ra

    Thank you Richard!

+ 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