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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:31:24+00:00 2026-06-10T08:31:24+00:00

Summary: I am writing a macro that takes names from many different sheets in

  • 0

Summary: I am writing a macro that takes names from many different sheets in an excel file and compiles them together on a “master list”, but I’m having trouble with referencing a cell on another sheet.

The Problem: When I refer to a specific cell using the sheet name as reference with Sheets("MasterList").ActiveCell.Offset(0, 1), nothing gets picked up. However, when I remove Sheets("MasterList") the macro works fine (the macro is currently on “MasterList” at the time which is the only way this would work). Also, the spelling for the name of the sheet was correct in my code.

Question: Why is this happening? The logic behind the code seems sound, and I’m spelling my sheet name correctly.

Code:

Do              

   If Sheets("MasterList").ActiveCell.Offset(0, 1) = firstName Then        'IF FIRST AND LAST NAMES MATCH, EXIT THE CHECK

          Exit Do

   End If

   On Error Resume Next

   Cells.Find(What:=lastName, After:=ActiveCell, LookIn:=xlFormulas, _
   LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
   MatchCase:=False, SearchFormat:=False).Activate

Loop Until Err.Number > 0
  • 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-10T08:31:26+00:00Added an answer on June 10, 2026 at 8:31 am

    ActiveCell is a property of the Application object, not a Sheet.

    There is only one ActiveCell, and it is the active cell on the currently active sheet.

    It’s not entirely clear what you are trying to do. But in general you should avoid Select and Activate with this sort of code. Use instead somthing like:

    Dim wsMasterList as Worksheet
    Set wsMasterList = Thisworkbook.WorkSheets("MasterList")  ' assuming the vba code is in the workbook containing MasterList
    

    To track the last used cell in MasterList use a variable like

    Dim rMasterList as Range
    Set rMasterList = wsMasterList.Cells( ...  ' Specify the cell you want
    

    Then use rMasterList.Offset(0, 1) to refer to cells relative to that cell

    Searching on MasterList use:

    Dim cl as Range
    Set cl = wsMasterList.UsedRange.Find( ... )
    If Not cl Is Nothing Then
        ' cl will be Nothing if the search term is not found
        ' ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a Silverlight screen that takes user input from a file, parses
I am writing an application that takes a users input (from a UITextView) and
Summary : is there a way to get the unique lines from a file
Summary: exporting pixel data from NSOpenGLView to some file formats gives incorrect colours I
SUMMARY: How to configure a web service such that writing to the Event Log
I'm writing a Plone product that takes iCalendar , pulls it in, and creates
I'm writing a windows service that processes a number of different rss news feeds
I'm writing an AJAX function that returns some information to display in a <div>
I'm writing a script that saves a figure with multiple formatting styles among which
I am writing a program that somewhat mimics the last command in UNIX, 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.