+ Reply to Thread
Results 1 to 15 of 15

VBA Macro Button that takes you to the next available blank cell in a specific column

  1. #1
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    VBA Macro Button that takes you to the next available blank cell in a specific column

    I am creating a log that will contain up to 300 entries. When a user goes to the log, I do not want for them to have to scroll down to the next available row. Can I create a button using VBA to automatically take you to the next row in column A that does not have anything in it?
    Last edited by jonvanwyk; 01-05-2011 at 01:50 PM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    You'll have to adapt the code here to your own workbook but this should do it.
    Attached Files Attached Files
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    I think we are on the right track, but I am having difficulty adapting it to my situation. In my situation, the rows begin with A3 and run through A300. A2 contains the label "Tow #", and changes depending on the day of the month/year and the next available tow number. The user defines this.

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    Quote Originally Posted by jonvanwyk View Post
    I think we are on the right track, but I am having difficulty adapting it to my situation. In my situation, the rows begin with A3 and run through A300. A2 contains the label "Tow #", and changes depending on the day of the month/year and the next available tow number. The user defines this.
    What I would do then is click on column A to highlight the whole column, go into the "names box" and name the column Tows, and then rename the range that I provided for you in the macro as Tows. you may need to fill in cells A1 and A2 with a "." or a "*" or whatever catches your pleasure (you can hide whatever you add there by making the font colour/color white). After that it should be alright. If not, upload a mock workbook and we'll take it from there.

    By the way, I feel that naming ranges is very useful when coding and that's why I suggested that you name the range Tows.

  5. #5
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    I attempted what you said to no avail. I am sure I am missing something simple. (See Attached Workbook)

    [Workbook deleted] >>> Newer one posted below.
    Last edited by jonvanwyk; 01-04-2011 at 04:36 PM.

  6. #6
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    At the moment, I cannot view your file properly as I am at work and using Office 2003. I can however look at this at home tonight if no one else jumps in for a solution. Sorry about that.

  7. #7
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    Quote Originally Posted by Mordred View Post
    At the moment, I cannot view your file properly as I am at work and using Office 2003. I can however look at this at home tonight if no one else jumps in for a solution. Sorry about that.
    2003? ick. I use 2010 at home and 2007 at work. I seem to be able to use a file in both of these versions with out entering some aweful "compatibility mode" that I used to have to deal with when I used 2007 at home and 2003 at the office. Get with the times man :-P

  8. #8
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    Haha, I am with the times at home as I have Office 2010 on my pc and my laptop but my work is lagging behind a bit. We were supposed to have 2007 implemented here last summer but we are all still waiting. I was hoping that we would get 2010 as it seems a little more stable than 2007 but I doubt that will happen.

  9. #9
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    Okay, well I thought I worked out the bugs, but I guess not. Attached to this reply is the new version of the workbook I am working with. If you cannot open my worksheet, I have also attached screenshots of the VBA I am trying to use.

    On worksheet "2010", A3:A300 is labeled "townumber"


    Please Login or Register  to view this content.

    On worksheet "2011", A3: A300 is labeled "townumber2011"

    Please Login or Register  to view this content.
    Attached Images Attached Images
    Attached Files Attached Files

  10. #10
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    Hopefully this does what you want. It works under the assumption that the user will fill out a row before using the button. Anyhow I've tested a few times and it seems to do what you want. Let me know.
    Attached Files Attached Files
    Last edited by Mordred; 01-05-2011 at 11:05 AM.

  11. #11
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    Yes, this does what I needed...thank you :-)

  12. #12
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    Why don't you use:

    Please Login or Register  to view this content.
    Doubleclick in A1 and you are in the first empty cell in column A



  13. #13
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    That looks simpler and easier, but the other one works too and I don't have time to go back and improve stuff that already works at the moment. I will save your suggestion for later though. :-)

  14. #14
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    @snb...Okay, the Form Control Buttons don't look exactly like the ActiveX command buttons...so I'll bite.

    How do I convert that to a form control macro button rather than making the user double click on A1, and with out using a command button?

  15. #15
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: VBA Macro Button that takes you to the next available blank cell in a specific co

    Nevermind...I figured it out.

+ 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