+ Reply to Thread
Results 1 to 4 of 4

Basic Macro (Jump to Cell) erroring out

  1. #1
    Registered User
    Join Date
    03-25-2008
    Posts
    10

    Basic Macro (Jump to Cell) erroring out

    i have 2 sheets in my workbook, and im trying to create several macros that jump to certain cells on either sheet. however, they keep erroring out, and i'm not sure why

    Sub first()
    '
    ' first Macro
    ' first shift
    '
    ' Keyboard Shortcut: Ctrl+f
    '
    Workbooks("macroGRL.xlt").Sheets("Guest Request Log").Range("B16").Select

    End Sub

    is my first macro. however it keeps erroring, targeting the specific cell reference (the entire line). i thought this was a pretty basic macro, so i dont understand why it is erroring out. i have several of these i'd like to do, so any help is appreciated

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    if you record a macro to do the same thing
    this one uses control+f to jump to sheet 2 q1 it looks like this
    Please Login or Register  to view this content.
    perhaps a simple record is easier!

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    kethyar


    Please read forum rules & wrap your VBA code

    A thread with the rules is available at the top of each forum or see links below

    If you do not understand the VBA code wrap instructions have a look at my last reply in this thread
    http://www.excelforum.com/showthread.php?t=583950
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  4. #4
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi,

    I had the same frustration as you for quite some time b/c I've always read that removing the individual selects & minimising the number of dots often results in faster code so I had done the same as you & I couldn't figure out why it wouldn't work until I found out about the "Goto" Method. If you want to remove the need for a 2 step process, here's a brief quote from the Help files...

    Excel 2003 VBE Help files:
    Goto Method
    Selects any range or Visual Basic procedure in any workbook, and activates that workbook if it’s not already active.
    expression.Goto(Reference, Scroll)
    expression Required. An expression that returns an Application object.
    Please Login or Register  to view this content.
    I suggest looking the Goto Method up & reading the rest of the Help Notes which explains why your single line doesn't seem to work.

    I also suggest changing your shortcut key from [ctrl + f] so that it is not the same as the default shortcut for Find in Excel (& a lot of the other app's in the Office suite) even if it is just changed to [ctrl + shift + f]. This will prevent any confusion if someone uses your computer or if you are distributing the file containing the macro.

    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1