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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:56:53+00:00 2026-06-14T05:56:53+00:00

1 2 3 4 . . So I have a sequence of numbers running

  • 0
1
2
3
4  
.
.

So I have a sequence of numbers running from 1-20. I have the number “1” on top selected and I would like to search the entire column and find the number “9”. The code works when I don’t name the range “rng”; it finds the number and selects. But the code stops working when I name the range of number. What’s wrong with the range function? could it be that if I define Dim rng as Range that when I later define the "Set rng=" I cannot have the ".Select" or ".Copy" extension on the end?

Sub macro2()

Dim rng As Range
Set rng = Range(ActiveCell, ActiveCell.End(xlDown)).Select
rng.Find(10).Select

End Sub

Also, If I want to sum the entire column from 1-20, on the last cell below the number “20” should I use the following code? because the application object doesn’t seem to do it. Thank you!

rng.End(xlDown).Offset(1, 0).Select
Application.WorksheetFunction.Sum (rng.Value)
  • 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-14T05:56:55+00:00Added an answer on June 14, 2026 at 5:56 am

    To look for 10 in the active column you could try this (which ends up selecting the first 10 – although Select in vba isn’t normally needed other than taken the user to location at code end)

    • test that the found range exists (ie you can find 10 before proceeding)
    • you should also use xlWhole to avoid matching 100 if the current default for [lookAt] is xlPart
    • using search [After] as Cells(1, ActiveCell.Column , and [Search Direction] as xlNext finds the first value looking down.

    code

    Sub QuickFind()
    Dim rng1 As Range
    Set rng1 = ActiveCell.EntireColumn.Find(10, Cells(1, ActiveCell.Column), xlFormulas, xlWhole, , xlNext)
    If Not rng1 Is Nothing Then
    Application.Goto rng1
    Else
    MsgBox "10 not found"
    End If
    End Sub
    

    Part 2

    Sub Other()
    Dim rng1 As Range
    Set rng1 = Range(Cells(1, ActiveCell.Column), Cells(Rows.Count, ActiveCell.Column).End(xlUp))
    rng1.Cells(rng1.Cells.Count).Offset(1, 0) = Application.WorksheetFunction.Sum(rng1.Value)
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: SQL query to find Missing sequence numbers I have a table which
I have a number of tables that use the trigger/sequence column to simulate auto_increment
I have a function that needs to append a sequence of numbers (starting with
I have a 6*6 puzzle with 35 numbers(1~35) in a random sequence. Use the
Actually I have to take the sequence number in $Revisions field.
I have a sequence which varies in length e.g. something like: items <- 1:4
I have a sequence like [0, 1, 0, 1, 0, 1, 0] and I
I have a table that I would like to be able to present ranked
I have the following code: int sequence = 1; //This is incremented every time
I have one hibernate sequence, that generates all sequence-numbers in my app. When I

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.