+ Reply to Thread
Results 1 to 4 of 4

Error when I use formula in VBA

  1. #1
    Registered User
    Join Date
    05-19-2014
    Posts
    35

    Error when I use formula in VBA

    Sub vinod_New()
    FHead = Sheets("Macro").Range("A" & i).Text
    Range("A2:A" & lx).Formula = "=COUNTIF(B2:GF2,"&FHead&")"

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Error when I use formula in VBA

    Please Login or Register  to view this content.
    don't know why it would not recognize the FHead variable as text, to add the required quote marks in the formula, you need to use the ASCII code character. Otherwise, if you try to concatenate the quote marks in, it will treat the variable as a string value and produce a worksheet error.

  3. #3
    Registered User
    Join Date
    05-19-2014
    Posts
    35

    Re: Error when I use formula in VBA

    Thanks JLG, this working now.

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Error when I use formula in VBA

    Quote Originally Posted by vinod2802 View Post
    Thanks JLG, this working now.
    You are welcome,
    regards, JLG

+ 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. [SOLVED] FORMULA Remove #NUM error not using IFERROR OR IS ERROR
    By JEAN1972 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-03-2017, 04:22 PM
  2. Formula error or data link error
    By sctr in forum Excel General
    Replies: 4
    Last Post: 09-19-2016, 09:15 AM
  3. [SOLVED] Inputbox error message. Formula you typed contains an error.
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-09-2013, 02:25 PM
  4. Excel 2007 : Formula error:bring up an #VALUE! Error.
    By burner007 in forum Excel General
    Replies: 3
    Last Post: 06-20-2011, 06:10 AM
  5. Formula Error-Error Message
    By Paige in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2006, 04:15 PM
  6. Replies: 4
    Last Post: 03-24-2006, 07:20 AM
  7. [SOLVED] Error values:DIV/0! error in SumProduct formula with no division
    By Jerry W. Lewis in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 PM

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