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

  • Home
  • SEARCH
  • 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 7819631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:01:29+00:00 2026-06-02T07:01:29+00:00

How do I use VBA in Excel to check if a below cell is

  • 0

How do I use VBA in Excel to check if a below cell is empty or not?
I want to sum all values in a specific range, but only, if the below cell is not empty.

Is that somehow possible with VBA or any other way?

Example:

4 2 3 2 1
2   3 1

Sum would be: 4 + 3 + 2 = 9.

  • 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-02T07:01:39+00:00Added an answer on June 2, 2026 at 7:01 am

    I would recommend a Formula for this

    FORMULA

    =SUMPRODUCT((A1:E1)*(A2:E2<>""))
    

    SNAPSHOT

    enter image description here

    If you still want VBA then

    VBA

    Option Explicit
    
    Sub Sample()
        Dim rng As Range
        Dim Cl As Range
        Dim tot As Long
    
        Set rng = Range("A1:F1")
    
        For Each Cl In rng
            If Len(Trim(Cl.Offset(1))) <> 0 Then tot = tot + Cl.Value
        Next
    
        Debug.Print tot
    End Sub
    

    In fact you can have many versions in VBA. You can evaluate the above formula as well. For example

    Option Explicit
    
    Sub Sample()
        Debug.Print Evaluate("=SUMPRODUCT((A1:E1)*(A2:E2<>""""))")
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use the Worksheet Change Event in Excel VBA, but it
Trying to use Excel VBA to capture all the file attributes from files on
I use WinHttp.WinHttpRequest.5.1 to send HTTP POST requests from VBA in Excel. But I
I need to use VBA to filter some information in excel. As I have
In an Excel formula you can use =ISERR(A1) or =ISERROR(A1) In a VBA macro
I want to use vba to take a screenshot (which will then be sent
ok I have couple of .NET classes that I want to use in VBA.
I'm trying to use Excel VBA to write to a text file. I'm doing
VBA newbie over here. I'm trying to use an array formula through excel vba
Is there a way to use VBA (excel) to generate a clock time with

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.