Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Excel VBA Code Issue

Excel VBA Code Issue

Scheduled Pinned Locked Moved Visual Basic
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Karma31251
    wrote on last edited by
    #1

    Sheets("Orders").Range("A2:G200").Select I have this code in a macro in a module on one workbook. I know the sheet is there, and the code will actually run every now and again but most of the time when i go to run the macro it gives me a 1004 runtime error, Select Method of Range Class Failed, I can't understand why this code will run only sometimes, its like there is a bug in the excel. Its simple straight forward code but it just won't go. Karma

    W 1 Reply Last reply
    0
    • K Karma31251

      Sheets("Orders").Range("A2:G200").Select I have this code in a macro in a module on one workbook. I know the sheet is there, and the code will actually run every now and again but most of the time when i go to run the macro it gives me a 1004 runtime error, Select Method of Range Class Failed, I can't understand why this code will run only sometimes, its like there is a bug in the excel. Its simple straight forward code but it just won't go. Karma

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      One problem could be that you have not defined the workbook where the sheet Orders is. So if the topmost workbook is not containing such sheet, it will fail.

      The need to optimize rises from a bad design. My articles[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups