+ Reply to Thread
Results 1 to 4 of 4

Help with code to copy result of formula in a cell

Hybrid View

  1. #1
    Registered User
    Join Date
    03-15-2021
    Location
    Newcastle, Australia
    MS-Off Ver
    365
    Posts
    2

    Help with code to copy result of formula in a cell

    Hi all,

    Fairly new to the coding side of things and learning on the go by creating small helpful things to get the feel for it.

    I have a basic code that copies a cell to the next available cell on another sheet. The cell contains a formula.

    Hoping someone can help with what to add so that the result of the formula is copied and not the formula itself.



    Private Sub CommandButton1_Click()
    
    Worksheets("Sheet 1").Range("B3").Copy _
            Destination:=Worksheets("Sheet 2").Cells(Worksheets("Sheet 2").Rows.Count, "C").End(xlUp).Offset(1, 0)
            
        
    
    End Sub


    Thanks in advance Excel Wizards *bow*
    Last edited by Climber-Jutt; 03-15-2021 at 06:19 PM.

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Help with code to copy result of formula in a cell

    You should be using code tags so your code looks like the solution below. see rule 2 of the forum.

    Private Sub CommandButton1_Click()
    
    Worksheets("Sheet 1").Range("B3").Copy
    Worksheets("Sheet 2").Cells(Worksheets("Sheet 2").Rows.Count, "C").End(xlUp).Offset(1, 0).pastespecial xlpastevalues
    
    End Sub

  3. #3
    Registered User
    Join Date
    03-15-2021
    Location
    Newcastle, Australia
    MS-Off Ver
    365
    Posts
    2

    Re: Help with code to copy result of formula in a cell

    Apologies,

    Will do from now on.

    Thanks.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Help with code to copy result of formula in a cell

    Or
    Worksheets("Sheet2").Cells(Rows.Count, 3).End(xlUp).Offset(1).Value = Worksheets("Sheet1").Cells(3, 2).Value
    It's all a personal preference

+ 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. Copy result from cell with formula to empty cell
    By banyanman in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-02-2016, 06:49 PM
  2. Replies: 7
    Last Post: 11-27-2015, 11:12 AM
  3. [SOLVED] Code result wrong but formula correct result
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-11-2014, 12:26 PM
  4. [SOLVED] Copy result of working code to next free row
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-21-2014, 05:21 PM
  5. [SOLVED] trying to write a vba that will copy a formula result and place it in another cell as text
    By Shellybelly in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-02-2014, 08:12 AM
  6. [SOLVED] Code to delete cell contents IF the result of a formula in the cell = 0
    By jayjaynz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-22-2013, 03:58 AM
  7. how do i copy a formula's result to another cell, without copying.
    By Mili in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-28-2005, 09:06 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