+ Reply to Thread
Results 1 to 7 of 7

Setting Active Cell as a variable.

  1. #1
    Registered User
    Join Date
    05-19-2015
    Location
    Tucson, Arizona
    MS-Off Ver
    2010
    Posts
    7

    Setting Active Cell as a variable.

    I'm righting a macro that will generate the EXP gained when fighting enemies in D&D and i ran into an issue. My main focus is to have the macro search for the enemies name then select its experience then do the necessary functions to show total EXP and EXP per player. Right now my code successfully searches for the monster, but when I try to set the currently selected cell as a variable to use in my first function it produce an answer of 0. Can anyone help me or see what wrong with the code? thank you.

    Please Login or Register  to view this content.
    Update:
    Found why i was getting 0 but now im getting -6 instead of 600.
    Last edited by xZOMBI3H3ADx; 07-29-2015 at 02:18 PM.

  2. #2
    Registered User
    Join Date
    05-19-2015
    Location
    Tucson, Arizona
    MS-Off Ver
    2010
    Posts
    7

    Re: Setting Active Cell as a variable.

    heres the workbook im using
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Setting Active Cell as a variable.

    I get a compile error on this line:

    Please Login or Register  to view this content.
    Sub or Function undefined.

  4. #4
    Registered User
    Join Date
    05-19-2015
    Location
    Tucson, Arizona
    MS-Off Ver
    2010
    Posts
    7

    Re: Setting Active Cell as a variable.

    Oh yeah I used a function

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Setting Active Cell as a variable.

    Your code works fine for me.

  6. #6
    Registered User
    Join Date
    05-19-2015
    Location
    Tucson, Arizona
    MS-Off Ver
    2010
    Posts
    7

    Re: Setting Active Cell as a variable.

    I don't know how but i exited excel and reopened it and now it works. thanks for trying to help anyway.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Setting Active Cell as a variable.

    You're welcome. Glad you got it up and running.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. setting variable equal to a value in a cell
    By ualdriver in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 02-25-2015, 06:01 AM
  2. Need help setting cell value as variable
    By OakMatt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-07-2014, 04:50 AM
  3. [SOLVED] Calling External Worksheet and Setting Variable for Active Workbook
    By jhuang5132 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-15-2014, 04:32 PM
  4. [SOLVED] Setting a Public Variable = the Active Cell
    By slm10 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-21-2014, 07:56 AM
  5. [SOLVED] Setting active cell on worksheet from .listindex
    By danmack in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-25-2012, 06:13 AM
  6. Setting cell reference as variable.
    By qcity in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 06-21-2011, 02:57 AM
  7. Replies: 2
    Last Post: 05-03-2006, 11:50 AM

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