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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:33:43+00:00 2026-06-14T23:33:43+00:00

I am writing a macro to transfer data from an input form to a

  • 0

I am writing a macro to transfer data from an input form to a storage table.
I have the rough code worked out, and it runs. Only if i have the destination sheet selected. If i try to run it from the sheet containing the form it throws the following error:
Run-time error '1004': Select method of Range class failed
But yet if i run the macro from the destination sheet it executes flawlessly.
Here is the code:

Sub ExpFormCharge()
    Dim pasteCell As Range
    Range("expenseTbl").ListObject.ListRows.Add AlwaysInsert:=False
    Range("ETBMARKER").Offset(-1, 0).Select
    Range("ExpFormBackend").Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
End Sub

The backend table is filled by another macro and this table is then copied and pasted into a new row in the expense table(the storage table). The line that is highlighted by the debug option is this one:
Range("ETBMARKER").Offset(-1, 0).Select
That refers to a marker, the total row of the storage table offset one so as to select the bottom row of the table.
This error occurs whenever a sheet other than the destination sheet is selected whether the code is executed from the vba window or from the macro selection pane.

  • 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-14T23:33:45+00:00Added an answer on June 14, 2026 at 11:33 pm

    Certain operations can only be performed on the Active sheet.

    Add

    Range("ETBMARKER").Parent.Activate
    

    before the line throwing the error.

    Just an aside, but you Dim a variable that you never use, and the line causing the error doesn’t do anything — you copy a different range on the very next line. You could remove those two lines, unless there is additional functionality you haven’t included in this code sample.

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

Sidebar

Related Questions

I'm writing a VBA macro in Excel that analyzes data from the spreadsheet and
I have started writing a Macro in Visual Studio 2005 like this: Public Sub
I am writing my first macro and have a question on how I can
I am writing a macro where there is a central input sheet - let
Summary: I am writing a macro that takes names from many different sheets in
I am writing a macro that will copy and paste information form one workbook
I am writing a Macro in excel VBA that creates a data validation list
I am writing a macro for Visual studio that will generate some code. I
I am writing a code to give the string to the macro..In macro i
I have run into a problem while writing C++ code that needs to compile

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.