+ Reply to Thread
Results 1 to 4 of 4

"this workbook"

  1. #1
    Registered User
    Join Date
    03-08-2007
    Posts
    1

    "this workbook"

    Is it possible to get a macro to return to "this workbook" when storing data via a macro on an excel data base, instead of creating a macro with a specific workbook name in it i.e

    Range("A7").Select
    ActiveCell.FormulaR1C1 = "='[NHSFORM.xls]NHS FORM'!R2C8"

    Thereby changing NHSFORM.xls in the macro - to "this workbook"

    Range("A7").Select
    ActiveCell.FormulaR1C1 = "='[This workbook.xls]This workbook'!R2C8"

    As, once the form has been "saved as" eg RHH12345 the macro ceases to work as it is still looking for the NHSFORM.xls worksheet

    Hope this makes sense.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Tisnoti,

    Drop the Workbook name in the formula. Excel assumes the workbook to be "ThisWorkbook" by default.

    Sincerely,
    Leith Ross

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

    Please read the forum rules - see links below

    Your post broke rule 2
    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
    Registered User
    Join Date
    03-22-2007
    Location
    Malaysia
    Posts
    21
    tisnoti,

    can you use this:

    Please Login or Register  to view this content.
    is it this you are referring to?

+ 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