+ Reply to Thread
Results 1 to 6 of 6

Need help with vbcode to get the correct value when running refresh button in excel.

  1. #1
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    311

    Need help with vbcode to get the correct value when running refresh button in excel.

    I have this vb code that I neew help with

    When opening file, I run a macro like this

    Please Login or Register  to view this content.
    So when I run refresh, it must give me new info B2 0.0000123 and not '0.000123.

    any help on this
    Last edited by hendrikbez; 08-19-2021 at 10:29 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Need help with vbcode to get the correct value when running refresh button in excel.

    Why are you doing this? That code forces the number to become text, which it sounds like you're saying you do not want.

    Please Login or Register  to view this content.

    Also you do not need to Select to operate on cells, and do not need to use FormulaR1C1 to assign values, and do not want to put numbers in quotes. Do this:

    Please Login or Register  to view this content.
    Other than that I can't figure out what you want your code to do.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    311

    Re: Need help with vbcode to get the correct value when running refresh button in excel.

    Thank you

    When I refresh the info, it is coming with the ' in front of the numbers, what I am trying to do with vb is to take the ' out in front of the numbers, but I tried it with what I have, and it is not working.

    The code is what I have done and it did not work.

    What I need is

    When press refresh button and new data is in the cells, this is where I need the vb code to take the ' out and left the new data as number in.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Need help with vbcode to get the correct value when running refresh button in excel.

    I think we are not communicating.

    You have a line of code that explicitly finds every number and puts ' in front it it. If you do not want that to happen, why did you put that in the code?

    I think I need to see your data. Can you attach your file?

  5. #5
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    311

    Re: Need help with vbcode to get the correct value when running refresh button in excel.

    I will give you the file

    Ok

    Why this code it there, I have just tried to get it to work, but has got it all wrong.

    It is the sheet SHIB that is not working

    Password for file is 6371
    Attached Files Attached Files
    Last edited by hendrikbez; 08-19-2021 at 12:16 PM.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Need help with vbcode to get the correct value when running refresh button in excel.

    Like I said, your code explicitly does the opposite of what you said you wanted, and I pointed out where the problem is. Try this modification. Switch What and Replacement::

    Please Login or Register  to view this content.

+ 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] Setting Print area with VBA code on active sheet - Can't get my code to work
    By hans302 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2017, 05:07 AM
  2. Testing single code, work fine. Put multiple codes in one sheet, one code doesn't work.
    By MayDay1988 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-30-2017, 06:14 PM
  3. Code will not work when followed by more code (does work when stepped through)
    By Cashgenerator in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-03-2015, 10:12 AM
  4. [SOLVED] Need help with VBA code. Tons of code seperated in two, second part of code doesn't work.
    By FragaGeddon in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-30-2015, 11:46 AM
  5. Replies: 9
    Last Post: 08-30-2013, 07:49 AM
  6. Replies: 1
    Last Post: 08-14-2013, 12:01 PM
  7. [SOLVED] hELP FOR MY PROJECT (IN PROJECT SHEET CODE NOT WORK,, OUTSIDE THAT CODE WORK)
    By santosh226001 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-06-2013, 06:53 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