Solved

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

Posted on 2014-09-05
6
169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

717 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