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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:05:37+00:00 2026-05-28T06:05:37+00:00

I am trying to look up cells in a certain column that have a

  • 0

I am trying to look up cells in a certain column that have a string (e.g. Names), copy the corresponding cells in the column to its right (i.e. offset(0,1) ), then paste it to a column in a different sheet. I have the following code to find the range variable that I want. However, I can’t select it from a different sheet!
When I use Sheets(1).MyRange.Copy, it doesn’t accept it. Am I referring to the range in a wrong way? What am I doing wrong?

Here’s code that I use to get MyRange:

Option Explicit

Sub SelectByValue(Rng1 As Range, Value As Double)

Dim MyRange As Range
Dim Cell As Object

 'Check every cell in the range for matching criteria.
For Each Cell In Rng1
    If Cell.Value = Value Then
        If MyRange Is Nothing Then
            Set MyRange = Range(Cell.Address)
        Else
            Set MyRange = Union(MyRange, Range(Cell.Address))
        End If
    End If
Next


End Sub

Sub CallSelectByValue()

 'Call the macro and pass all the required variables to it.
 'In the line below, change the Range, Minimum Value, and Maximum Value as needed
Call SelectByValue(Sheets(1).Range("A1:A20"), "Tom")

End Sub

One More Question: Rather than specifying the exact range to look at (e.g. “A1:A20”), I would LOVE to look at all of column A. But I don’t want to use (“A:A”) so it wouldn’t look at all rows of A. Isn’t there a method to look only in cells that have entries in column A?

Thank you VERY much.

Al

  • 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-28T06:05:38+00:00Added an answer on May 28, 2026 at 6:05 am

    You only need MyRange.Copy.

    To restrict only to cells in column A which might have values, you could use

    With Sheet1
       Set rngToSearch = Application.Intersect(.Columns(1), .UsedRange)
      End With
    

    …or maybe look at .SpecialsCells()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to take file names that look like: MAX_1.01.01.03.pdf look like Max_1010103.pdf.
I'm trying to look for a unique 32-bit integer that I can access in
I've been been trying to look for a piece of javascript code that compares
I'm trying to make the cells of a QTableView look like 3D clickable buttons.
I have some trouble trying to get the values of the first column with
Im trying to start a wxPython app that (I have converted to an exe
I have a pivot table with some data that im trying to reference with
Im trying to look into using the WPF WriteableBitmap class to allow my application
I am trying to look up a QueueConnectionFactory and Queue via Geronimo's JNDI. The
How can I implement recursive MySQL Queries. I am trying to look for it

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.