Results 1 to 26 of 26

Help with Pasting Value only

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-03-2020
    Location
    Wisconsin
    MS-Off Ver
    365
    Posts
    150

    Help with Pasting Value only

    Hello! First of all let me explain that I do not know VBA code - I have pieced together my code from other forum posts and youtube. So when helping, please give me something I can easily type without changing a ton IF POSSIBLE.

    So this code is to help me take some information from 1 worksheet and then send it to another worksheet (in the same workbook) to create a data dump for metric tracking. Here is the code so far:
    ---------------------------------------------------------------------------------------------------------------
    Private Sub CommandButton1_Click()
    
    'Create and set variables for the Call Tracking & Call Log worksheets
    Dim CTrk As Worksheet, CLog As Worksheet
    
    Set CTrk = Sheet1
    Set CLog = Sheet4
    
    
    'Create and set variables for each cell in the call tracking sheet
    Dim OrdDate As Range, PrtNo As Range, WrkOrd As Range
    Dim PoNo As Range, CSComp As Range, CompDate As Range
    
    Set OrdDate = CTrk.Range("E13")
    Set PrtNo = CTrk.Range("A13")
    Set WrkOrd = CTrk.Range("C13")
    Set PoNo = CTrk.Range("D13")
    Set CSReq = CTrk.Range("I13")
    Set CSComp = CTrk.Range("T8")
    Set CompDate = CTrk.Range("R13")
    
    
    'Create a variable for the paste cell in the Call Log worksheet
    Dim DestCell As Range
    
    If CLog.Range("A2") = "" Then 'If A2 is empty
        Set DestCell = CLog.Range("A2") '...then destination cell is A2
    Else
        Set DestCell = CLog.Range("A1").End(xlDown).Offset(1, 0) '...otherwise the next empty row
    End If
    
    'If no "Number called has been entered, exit macro
    If PrtNo = "" Then
        MsgBox "You must enter a Part Number before adding to the log"
        Exit Sub
    End If
    
    'Copy and paste data from the Call Tracking worksheet to the Call Log worksheet
    OrdDate.Copy DestCell
    PrtNo.Copy DestCell.Offset(0, 1)
    WrkOrd.Copy DestCell.Offset(0, 3)
    PoNo.Copy DestCell.Offset(0, 4)
    CSReq.Copy DestCell.Offset(0, 5)
    CSComp.Copy DestCell.Offset(0, 6)        I NEED THIS TO BE A PASTE VALUE ONLY - NOT FORMULA
    CompDate.Copy DestCell.Offset(0, 7)
    
    End Sub
    ----------------------------------------------------------------------------------

    The section of the code where I turned the text to red is where I need help. Currently this code works perfectly for what I need except this one line always pastes the formula, and understandably so, but I need it to be value only. In fact, all of them can be value only...if that helps you help me. But this is the one that I need,

    Thank you so much!
    Last edited by vg05; 10-04-2021 at 08:46 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Pasting data into every second row, and also pasting it as a duplicate
    By rhibrown in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-24-2019, 06:04 PM
  2. [SOLVED] Two Totals Pasting to Wrong Column - The rest are pasting correctly
    By CHRISOK in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-20-2018, 05:00 PM
  3. pic pasting
    By kraman183 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-24-2013, 04:20 AM
  4. Replies: 10
    Last Post: 02-09-2010, 05:04 AM
  5. Copy+pasting from Firefox vs Copy+pasting from IE
    By srbloom in forum Excel General
    Replies: 0
    Last Post: 02-02-2009, 05:45 PM
  6. [SOLVED] Pasting on Filtered Data Sheets without pasting onto hidden cells
    By CCSMCA in forum Excel General
    Replies: 1
    Last Post: 08-28-2005, 09:05 AM
  7. Replies: 3
    Last Post: 03-26-2005, 11:06 PM

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