+ Reply to Thread
Results 1 to 6 of 6

Excel VB: How do I apply a VBA code to one column only

  1. #1
    Registered User
    Join Date
    02-21-2012
    Location
    Harrisburg, PA
    MS-Off Ver
    Excel 2003
    Posts
    11

    Excel VB: How do I apply a VBA code to one column only

    I want to be able to click a button where the code behind the button looks at just one volumn from say A4 to A9999. Whats the best way to do that in Excel Macro


    Thanks

  2. #2
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Excel VB: How do I apply a VBA code to one column only

    Are you trying to select the column? Or look at each cell in the column for specific information? Or what? What do you want the button to do?

  3. #3
    Registered User
    Join Date
    02-21-2012
    Location
    Harrisburg, PA
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Excel VB: How do I apply a VBA code to one column only

    Quote Originally Posted by LaffyAffy13 View Post
    Are you trying to select the column? Or look at each cell in the column for specific information? Or what? What do you want the button to do?
    I am trying to apply a code only to a single column. I am checking all cells in the column if they have more than 2 decimal places on the click of a button. If they do, the row is highlighted.


    Thanks

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Excel VB: How do I apply a VBA code to one column only

    The basic idea...

    Please Login or Register  to view this content.
    HTH
    Regards, Jeff

  5. #5
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Excel VB: How do I apply a VBA code to one column only

    What jeffreybrown gave you should work. As for the cells with more than 2 decimal places, I haven't a clue how to identify them all. If the cells are formatted as a "Number" and not "General", then here is how to highlight all of the rows that have 3 decimal places. Maybe that can give you an idea. This would go exactly where jeffreybrown has written "'Run macro here"

    Please Login or Register  to view this content.

  6. #6
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Excel VB: How do I apply a VBA code to one column only

    Please Login or Register  to view this content.
    Hasan,

    This should get everything with more that 2 decimals. Do you want it to always end with A9999 or would you like it to end with the last row in A that has data?
    Last edited by Solus Rankin; 07-09-2013 at 10:05 AM.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

+ 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