+ Reply to Thread
Results 1 to 4 of 4

Calling a formula within a VBA sub

  1. #1
    Registered User
    Join Date
    06-02-2010
    Location
    West Lafayette, IN
    MS-Off Ver
    Excel 2003
    Posts
    3

    Question Calling a formula within a VBA sub

    I want to use the RIGHT formula in my sub.

    Right now this is what I have -


    Please Login or Register  to view this content.
    As you can see - I have labelled 2 different sheets different things (rooms and data) however, it won't let me use the RIGHT formula on the information from Data because it says there is a syntax error and has the line:

    Please Login or Register  to view this content.
    highlighted in red.

    Does anyone know a way I can fix this?
    Last edited by enswitze; 06-03-2010 at 06:15 PM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Calling a formula within a VBA sub

    Please wrap your code in code tags, before the moderators get you...

    Forum rules
    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button.

    Cheers

  3. #3
    Registered User
    Join Date
    06-02-2010
    Location
    West Lafayette, IN
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Calling a formula within a VBA sub

    thanks... sorry about that!

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Calling a formula within a VBA sub

    Change this line

    Please Login or Register  to view this content.

    to
    Please Login or Register  to view this content.

    Because you have "RIGHT(Worksheet("Data").Cell(RowChanger, 1), 3)" in quotes this is read as a string, not a function.

    Hope this helps.

    If you need any further information, please feel free to ask further

    However

    If this takes care of your needs, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED. It helps everybody!
    Also
    If you are satisfied by any members response to your problem please consider using the scales icon top right of thier post to show your appreciation.

+ 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