Solved

I need a macro that will "go to next blank line" in Excel 2013

Posted on 2014-09-05
6
162 Views
Last Modified: 2014-09-05
I need a macro that will "go to next blank line" in Excel 2013. I can write simple macros, but this has me stumped. Any ideas?
0
Comment
Question by:LLMadden
  • 3
  • 3
6 Comments
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40306590
Typically from any selected cell, to move to and select the next blank line:
 
ActiveCell.End(xlDown).Offset(1, 0).Select

Open in new window


However, the End command could move the selection several blank cells past if already in a blank area, so, this is more bullet-proof:
 
   If ActiveCell.Offset(1, 0).Value = "" Then
        ActiveCell.Offset(1, 0).Select
    Else
        ActiveCell.End(xlDown).Offset(1, 0).Select
    End If

Open in new window



Regards,
-Glenn
0
 

Author Comment

by:LLMadden
ID: 40306630
Hi Glenn, I'm very new to macros, can you show me what it would look like in the VBA window?
0
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 500 total points
ID: 40306654
Sure.  
 sample VBA project and code
Note that I changed the code!  It wasn't as bullet-proof as I thought!  Here's the updated code if you want to copy and paste.
Sub Next_Blank()
    If ActiveCell.Offset(1, 0) = "" Then
        ActiveCell.Offset(1, 0).Select
    Else
        ActiveCell.End(xlDown).Offset(1, 0).Select
        If ActiveCell.Value <> "" Then
            ActiveCell.End(xlDown).Offset(1, 0).Select
        End If
    End If
End Sub

Open in new window


-Glenn
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:LLMadden
ID: 40306757
This is perfect, works exactly as I had hoped. This saved me a lot of work. Thank you!!
0
 

Author Closing Comment

by:LLMadden
ID: 40306765
Perfect! Thank  you so much!
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40306783
You're welcome.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

808 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