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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:39:19+00:00 2026-05-23T20:39:19+00:00

I am writing an application in VBA for excel. Using some conditions and counting

  • 0

I am writing an application in VBA for excel. Using some conditions and counting the number of records by the following functions which is working fine.

   cnt = appExcel.Application.CountIfs(R1, AuditType, R2, "Fail", UserRange1, UserName & "*")

Here R1,R2 and UserRange1 are Range types which is describing individual cells.
If we print

R1.Address  '$E:$E
R2.Address ' $M:$M so on.

I am getting the number of rows present with those criteria in “cnt” variable.

I need further manipulation like searching some custom cells from the above range of cells. To do that I need to store those addresses in a “Range” object.
Please guide me how can I store those filtered records in a range. I don’t want to copy to another area also.

  • 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-23T20:39:20+00:00Added an answer on May 23, 2026 at 8:39 pm

    You add a new range to a worksheet by declaring a Name object in VBA and then setting it’s RefersTo value to the address. This example adds the needed declarations and code to do this. It assumes that you are interested in the cells in your R1 range which contain constants:

    Dim rngFiltered As Excel.Range
    Dim nmNew As Excel.Name
    
    '...
    
    Set rngFiltered = R1.SpecialCells(xlCellTypeVisible)
    Set nmNew = ws.Names.Add(Name:="NewRange", RefersTo:="=" & rngFiltered.Address)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an application which reads large arrays of floats and performs some simple
im writing an application that downloads and installs addons for programs which needs to
I'm writing an application that on some stage performs low-level disk operations in Linux
I'm writing an application to start and monitor other applications in C#. I'm using
I'm trying to rewrite some VBA code in Excel VSTO. The VBA code is
When writing an application using the GIO and GVFS libraries from the GNOME stack
I am writing an application which uses the DCM MKDIR, We save our images
I am currently writing an application ( App1 ) which retrieves portions of text
I'm writing an application with some embedded video content, it's Android 2.2 that I'm
When writing application code, it's generally accepted that premature micro -optimization is evil, and

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.