View Poll Results: How to fix?

Voters
4. This poll is closed
  • don't do it

    0 0%
  • just type it into a cell and drag the corner to copy and paste function

    0 0%
  • use a totally different function

    0 0%
  • get frustrated and smash the key board

    1 25.00%
  • stop vba

    0 0%
  • write other coding to go with it

    0 0%
  • stop the project for 1 year and start getting better and learning new things before any projects

    3 75.00%
+ Reply to Thread
Results 1 to 11 of 11

How to enter a formula in VBA?

  1. #1
    Forum Contributor
    Join Date
    08-22-2012
    Location
    nj, us
    MS-Off Ver
    Excel 2010
    Posts
    163

    Angry How to enter a formula in VBA?

    I tried to enter a function into cell d6, but it says there is an error
    i tried:

    Please Login or Register  to view this content.
    It says that>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>this ^ should be the end of the statement
    why?
    :] ???
    Last edited by jeffreybrown; 08-22-2012 at 12:17 PM. Reason: Please use code tags when posting code

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,679

    Re: How come i can't do this?

    Open the VBE Immediate window, and enter this:

    ? "=IF(OR(WEEKDAY(C6)=7,WEEKDAY(C6)=1)"1","")" '1","" ',"","")

    Does the line that appears look like a well-formed formula?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    08-22-2012
    Location
    nj, us
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: How come i can't do this?

    but how does it know to put it in Range("D6")?

    ---------- Post added at 11:34 AM ---------- Previous post was at 11:31 AM ----------

    and i do not know how to use immediate window

    ---------- Post added at 11:36 AM ---------- Previous post was at 11:34 AM ----------

    hello? danmarsh? nickmax1? SARAH_MUNFORD? do u know?

    ---------- Post added at 11:46 AM ---------- Previous post was at 11:36 AM ----------

    hello? danmarsh? nickmax1? SARAH_MUNFORD? do u know?

    ---------- Post added at 11:47 AM ---------- Previous post was at 11:46 AM ----------

    How do i insert attachment?

    ---------- Post added at 11:52 AM ---------- Previous post was at 11:47 AM ----------

    how to insert file?

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: How come i can't do this?

    Quote Originally Posted by shg View Post
    Open the VBE Immediate window, and enter this:

    ? "=IF(OR(WEEKDAY(C6)=7,WEEKDAY(C6)=1)"1","")" '1","" ',"","")

    Does the line that appears look like a well-formed formula?
    I'm going to go out on a limb shg and say no.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  5. #5
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: How to enter a formula in VBA?

    Quote Originally Posted by john456852 View Post
    I tried to enter a function into cell d6, but it says there is an error
    i tried:

    Please Login or Register  to view this content.
    It says that>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>this ^ should be the end of the statement
    why?
    :] ???
    I don't think you can name your procedure Function, you may be getting errors because the word Function is reserved. Plus, as shg pointed out, your formula is erroneous.

  6. #6
    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: How to enter a formula in VBA?

    Maybe ...
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    08-22-2012
    Location
    nj, us
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: How to enter a formula in VBA?

    How is there an error?
    and i typed wrong
    it is supposed to be "Private Sub CommandButton2_Click()"

    ---------- Post added at 01:09 PM ---------- Previous post was at 01:08 PM ----------

    Thx Marcol

  8. #8
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: How to enter a formula in VBA?

    Marcol fixed your error in the formula.

  9. #9
    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: How to enter a formula in VBA?

    Okay try
    Please Login or Register  to view this content.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  10. #10
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: How to enter a formula in VBA?

    On your first post, click on "Thread Tools" and mark it as solved.

  11. #11
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to enter a formula in VBA?

    @ john456852

    Based on your last post it seems that you are having trouble marking your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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