+ Reply to Thread
Results 1 to 13 of 13

Copy integer from a range with formule

  1. #1
    Registered User
    Join Date
    05-12-2020
    Location
    Lima,Peru
    MS-Off Ver
    2016
    Posts
    25

    Copy integer from a range with formule

    Good Afternoon friends and Masters of VBA Excel
    I waste time tryint to find information about how copy range of cells from a sheet01 to sheet02.
    But I dont want copy formulas, I want copy only the numbers that those formulas generate.
    When I use the code below.. it pick the formulas...
    How I can change the code for only pick numbers?

    I see that exist Formula=Value
    But I dont have clear how use it

    Please help me!


    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    03-31-2006
    MS-Off Ver
    Excel 2003
    Posts
    76

    Re: Copy integer from a range with formule

    Please Login or Register  to view this content.
    Last edited by 5631; 05-15-2020 at 07:49 AM. Reason: Formatting

  3. #3
    Registered User
    Join Date
    05-12-2020
    Location
    Lima,Peru
    MS-Off Ver
    2016
    Posts
    25

    Re: Copy integer from a range with formule

    Thanks for your help.
    I get Run-time error '438':
    Object doesnt support this property or method

    I am using Excel2016 and google say that the problem is caused for excel2003 (add in corrupted).
    Other explanation say: You specified a method or property that doesn't exist for this Automation object.

    Maybe is a problem with the type of button?
    The button I put in PxH sheet and the same problem if I put in PxHpoints.

    Debug color yellow in: Sheets("PxH").Range ("D12:O12")

    Sorry for ask for your help again.
    But please...

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

    Cool Hi ! Try this !


    Nothing to do with the button, just a bad code …

    As a VBA beginner starter :

    PHP Code: 
    Private Sub CommandButton1_Click()
        
    Range("PxHpoints!D5:O5").Value2 Range("PxH!D12:O12").Value2
    End Sub 
    ► Do you like it ? ► ► So thanks to click on bottom left star icon « Add Reputation » ! ◄ ◄

  5. #5
    Registered User
    Join Date
    03-31-2006
    MS-Off Ver
    Excel 2003
    Posts
    76

    Re: Copy integer from a range with formule

    Sorry, see my correction.

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

    Re: Copy integer from a range with formule


    As you can rewrite your code without any Select neither Selection just direcly working with objects …

  7. #7
    Registered User
    Join Date
    05-12-2020
    Location
    Lima,Peru
    MS-Off Ver
    2016
    Posts
    25

    Re: Copy integer from a range with formule

    Thanks for your time.
    Now I have run time error 1004: Select method of Range class failed.
    I am surprised that an apparent simple procedure get so hard to solve...
    or maybe is a procedure that Vba usually dont use.

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

    Question Re: Copy integer from a range with formule


    No it's common when the initial post is not well elaborated as we can't guess the context, all you forgot to explain …

    Did you at least try post #4 ?!

  9. #9
    Registered User
    Join Date
    05-12-2020
    Location
    Lima,Peru
    MS-Off Ver
    2016
    Posts
    25

    Re: Copy integer from a range with formule

    Yes friend, I try all the recomendations and nothing working. Then there is no way that copy the big table and paste only number and work with this Sheets("PxH").Range("D12:O12").Copy Destination:=Sheets("PxHpoints").Range("D5") or some modifications. And the context is very simple, is like you put in a cell: = 10*5 and you want copy that to other sheet/cell and only want pick the "50" and dont pick the formula. If you can do with a cell, sure you can do with a range. Please can you do this master explanation about this concept. I dont find that in any other forum.. I am tired to search and search... books dont have references, too.

    Thanks for your time and sorry for boring with this matter.

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

    Arrow Re: Copy integer from a range with formule


    As post #4 the direct way to go well works on my side like you can find everywhere on Web, the bad is on yours !

    So as this is so simple, any Excel beginner can activate the Macro Recorder and operate manually, that's so easy !
    You will get a code base looking like post #2.

    In case of any error during the manual operations, that's the part you missed to elaborate in your initial post …
    Last edited by Marc L; 05-15-2020 at 10:09 AM.

  11. #11
    Registered User
    Join Date
    05-12-2020
    Location
    Lima,Peru
    MS-Off Ver
    2016
    Posts
    25

    Re: Copy integer from a range with formule

    You are right! I use macro record and it work nicely.
    Thanks.

  12. #12
    Registered User
    Join Date
    03-31-2006
    MS-Off Ver
    Excel 2003
    Posts
    76

    Re: Copy integer from a range with formule

    Quote Originally Posted by Marc L View Post

    As you can rewrite your code without any Select neither Selection just direcly working with objects …
    I don't think it's necessary fot the thread starter.

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

    Arrow Re: Copy integer from a range with formule


    I think so as a good code does not need to Select anything like a poor code generated by the Macro Recorder,
    as working directly with objects is more efficient / faster than using Select …

    For such a code, I just advise the OP to directly use the Macro Recorder …

+ 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] Adding an Integer to a range
    By SteynfaardtD in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 01-08-2019, 02:29 PM
  2. [SOLVED] Loop on the Row as integer, getting integer into a range
    By Fean in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2018, 07:16 AM
  3. [SOLVED] Writing formule from VBA into range on worksheet based on condition
    By blaxpander in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-06-2013, 05:10 AM
  4. UDF - Integer NOT in range
    By vetinari in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2011, 10:31 PM
  5. dynamic range (table_array) in vlookup formule
    By cuoredicapitano in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-11-2010, 11:09 AM
  6. Count the number of occurrences of an integer withing a larger integer
    By nnktran in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2010, 01:04 PM
  7. Replies: 2
    Last Post: 08-16-2009, 04:33 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