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 8983309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:48:37+00:00 2026-06-15T20:48:37+00:00

How using VBScript I can count the number of rows filled with data and

  • 0

How using VBScript I can count the number of rows filled with data and how many column has a value for a particular row?

       Col1 Col2 Col3 ........ColN-1  ColN+1...ColN+2.......ColN+2

 Row1   A         B                             Null         Null
 Row2   1    2    Y                             .
 Row3        2                                  .
 Row4        P    Z 
  .                                             .
  .
  .
 RowN-2                                         .
 RowN-1                         T        L      Null.......Null
 RowN                     S
 RowN+1 Null ........(till the last column of the excel sheet that its version supprts.)

So here my required Loop iteration which i would use for my other logic is N for rows and for columns it would be N+1
Update

   Option Explicit

   Dim rg,CountBlank

   For C=0 to 10

    Set rg = Ob6.Range(Ob6.Columns(c),Ob6.Columns(c))
    CountBlank = objExcel1.Application.WorksheetFunction.CountBlank(rg)
    MsgBox("Column"&C": "&"Has"&(rg.rows.Count-CountBlank))
 Next

Thanks

  • 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-06-15T20:48:38+00:00Added an answer on June 15, 2026 at 8:48 pm

    Try this to get you started. It will show for each row the number of columns that have data, and for each column the number of rows that have data. You can then modify it to more suit your needs:

    EDIT: Code updated to capture first row / column with only 1 column / row of data:

    Option Explicit
    
    Dim rg
    
    'loop through columns
    For C=0 to 10
    
        Set rg = Ob6.Columns(c)
    
        If objExcel1.Application.WorksheetFunction.CountA(rg) =1 Then
    
           Exit For
    
        End If
    
    Next
    
    MsgBox("Column" & C & " is first column with only 1 row")
    
    'loop through rows
    For C=0 to 10
    
        Set rg = Ob6.Rows(c)
    
        If objExcel1.Application.WorksheetFunction.CountA(rg) =1 Then
    
           Exit For
    
        End If
    
    Next
    
    MsgBox("Column" & C & " is first row with only 1 column")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I check for registry value using VbScript?
How can I terminate process using vbscript. PLEASE NOTE, I need to terminate process
Using vbscript, how can I filter the output from a WMI Query? I want
I'm trying to find all Thursdays within a given Month using VBScript. Can anyone
I'm trying to submit some post data form using vbscript. The site I'm posting
Using VBScript, how can I list all WMI classes that represent events? Thanks in
How can I get the description from an WMI class using vbscript? I found
i'm using vbscript to extract data from db2 and write to file. Writing to
i am using vbscript to call a batch file. my script looks like: dim
I like to end a process using VBScript. Unfortunally I only found examples in

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.