+ Reply to Thread
Results 1 to 12 of 12

Adding values that have been given string

  1. #1
    Registered User
    Join Date
    04-12-2019
    Location
    Dallas
    MS-Off Ver
    2016
    Posts
    64

    Adding values that have been given string

    I have a few different variables that are set with a string to be placed into the worksheet . I am trying to get the values that are placed in those cells when the string is assigned to them. The numbers will move everyday so I can't select that particular range to add. This is the code I have, but it's bringing back the error Compile error: Invalid qualifier where "I" and "k" are. I've tried just a + b + c +... as well as adding .Value & .Value2

    Please Login or Register  to view this content.

  2. #2
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Adding values that have been given string

    you seem to be assigning formulas and trying to collect the answers before they have been allocated to the cells. Try moving and evaluating i and k until after the above code. Cant check without workbook

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Exclamation


    As for example your variable a is not an object - String or Variant - so it can't have any property like Value !
    Easy to check in Locals windows … Don't forget the brackets for Evaluate, to see in VBA inner help !

  4. #4
    Registered User
    Join Date
    04-12-2019
    Location
    Dallas
    MS-Off Ver
    2016
    Posts
    64

    Re: Adding values that have been given string

    Still had the same error when moved. If I just do a + b + c + … it brings back FALSE, only one that is giving me a value and not an error

  5. #5
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Adding values that have been given string

    if i do a typename(a) before your "i=" line, it says that it is a string. thus you will not be able to say a.value2 as "a" is not a range that you can get the value2 property.

  6. #6
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Adding values that have been given string

    No one is going to recreate your workbook structure to test. You seem to want to allocate formulas to offsets from a cell but offset from what??. Post a workbook without any sensitive data

  7. #7
    Registered User
    Join Date
    04-12-2019
    Location
    Dallas
    MS-Off Ver
    2016
    Posts
    64

    Re: Adding values that have been given string

    I figured it out, just had a take a long way with probably too many lines of code

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    See this ‼

    (cleared as duplicate)
    Last edited by Marc L; 06-14-2019 at 09:44 AM.

  9. #9
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool


    According to your piece of code as a beginner starter :

    PHP Code: 
      Const "SUMPRODUCT((MONTH(Data!A2:A2000)=7)*(YEAR(Data!A2:A2000)=2019)*(Data!#2:#2000))"
        
    Dim VC%
            
    = [{"S","V","Y","AB","AE","AN","AK","AH"}]
        For 
    1 To 8
            cl
    .Offset(, C).Value2 Evaluate(Replace(F"#"V(C)))
        
    Next
            cl
    (110).Value2 Application.Sum(cl(12).Resize(, 8))
            
    cl(111).Value2 Evaluate(Replace(F"#""AT"))
            
    cl(112).Value2 cl(110).Value2 cl(111).Value2 
    Do you like it ? So thanks to click on bottom left star icon Ğ Add Reputation ğ !

  10. #10
    Registered User
    Join Date
    04-12-2019
    Location
    Dallas
    MS-Off Ver
    2016
    Posts
    64

    Re: Adding values that have been given string

    This line: cl.Offset(, C).Value2 = Evaluate(Replace(F, "#", V(C))) is coming back with a Type Mismatch error

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question

    How can I test without any attachment ?

    Erase my code and try again from post #9 as I mod the original code (typo) in post #8 …

  12. #12
    Registered User
    Join Date
    04-12-2019
    Location
    Dallas
    MS-Off Ver
    2016
    Posts
    64

    Re: Adding values that have been given string

    Post #9 worked, Thank you

+ 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. Advanced string manipulation-Adding spaces to a string
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-22-2019, 08:08 PM
  2. Search through sells for a string, and adding string where is not added
    By gekko.online in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-20-2017, 02:23 AM
  3. [SOLVED] Adding values in a string without using an array
    By gassiusmax in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-04-2015, 10:57 PM
  4. Why is my UserForm code adding a string of values instead of the values themselves?
    By RayJay01 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2013, 10:25 AM
  5. Replies: 5
    Last Post: 11-08-2012, 03:38 PM
  6. Help needed with text string adding for MID and Right whole/fractional Values
    By JadeEyes in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-02-2012, 06:21 PM
  7. adding values as 1 string, based on adjacent column
    By TCountryman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2010, 10:51 AM

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