Solved

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

Posted on 2014-09-05
6
159 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now