Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6739369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:28:48+00:00 2026-05-26T11:28:48+00:00

Hi there i have a similar question to the question posed at Move from

  • 0

Hi there i have a similar question to the question posed at

Move from one cell to another and count the number of rows in between two data

In my example i would like count the number of rows between non-empty cells (including the original data line itself) in column A and put the count in Column B

My data starts at A1 and moves down with blanks in cells until the the next data row.

Example:

A1 1        B1 3
A2          B2 4
A3          B3 2
A4 2        B4 3
A5  
A6  
A7 
A8 3  
A9  
A10 4
A11 
A12 

I tried to make mods to the original solution posted but i cant seem to get the count for the last row.

Any assistance would be very much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:28:49+00:00Added an answer on May 26, 2026 at 11:28 am

    Not sure if I quite get what your asking for but try something like this:

        Private Sub CountSkips()
    
        Dim lStart As Long, lEnd As Long
        Dim rData As Range, rNext As Range
        Dim vData As Variant
    
        Set rData = ActiveSheet.Range("A1" _
                    , ActiveSheet.Cells(Application.Rows.Count, 1).End(xlUp))
        vData = rData.Resize(rData.Rows.Count + 1).Value2
    
        Set rNext = rData.Resize(1)
        Do While rNext.Row <> Application.Rows.Count
            lStart = rNext.Row
            Set rNext = rNext.End(xlDown)
            If LenB(vData(lStart + 1, 1)) = 0 Then
                lEnd = rNext.Row
                rNext.Offset(lStart - lEnd, 1) = lEnd - lStart
            End If
        Loop
    
    End Sub
    

    Update:

    The other way to do it, from your comment it sounded like you want the number by the item after the blank.

    Private Sub CountSkips()
    
        Dim lStart As Long, lEnd As Long, lVeryLastRow As Long
        Dim rData As Range, rNext As Range
        Dim vData As Variant
    
        lVeryLastRow = Application.Rows.Count
        Set rData = ActiveSheet.Range("A1" _
                    , ActiveSheet.Cells(lVeryLastRow, 1).End(xlUp))
        vData = rData.Resize(rData.Rows.Count + 1).Value2
    
        Set rNext = rData.Resize(1)
        Do While rNext.Row <> Application.Rows.Count
            lStart = rNext.Row
            Set rNext = rNext.End(xlDown)
            If LenB(vData(lStart + 1, 1)) = 0 And rNext.Row <> lVeryLastRow Then
                lEnd = rNext.Row
                rNext.Offset(, 1) = lEnd - lStart
            End If
        Loop
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A similar question was posted as question:is-there-a-way-to-use-multiple-wsit-client-xml.. . I have two different WS-Security enabled
There have been a few similar questions with solutions, but none answered my question,
There is a similar question here on SO, but I have a fairly small
I noticed prior to posting this question that there have been similar questions posted
My question is similar to this one: Compare rows and get percentage However, little
This question sounds similar to many posed here, but it's obnoxiously different. I have
There have been some similar questions asked regarding Grid views, but none have been
I know there have been some similar questions to this, but they haven't helped
There might be similar questions but I still have some parts that I couldn't
I know there are other questions that have similar issues, but I have read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.