+ Reply to Thread
Results 1 to 4 of 4

Copy/Paste Values Using VBA Code

  1. #1
    Registered User
    Join Date
    09-08-2014
    Location
    Houston, Texas
    MS-Off Ver
    10
    Posts
    17

    Copy/Paste Values Using VBA Code

    Hello,

    I am trying to write a Macro where it will use date and time (protected fields), and copy and paste values for only fields that have a formula. I am almost there, but I keep getting a debug run time error 1004.

    Please Login or Register  to view this content.
    Thank you,

    Daniel

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Copy/Paste Values Using VBA Code

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Range("a2:A1048575")) Is Nothing Then

    If Target.Offset(0, 1).Locked = False Then
    ActiveSheet.Unprotect "isitontime"
    Target.Offset(0, 1).Value = Now
    Target.Offset(0, 1).Locked = True
    Target.Offset(0, 0).Locked = True
    Target.Offset(0, 2).Locked = True

    Range("C1:C100").copy Range("D1:D100")

    ActiveSheet.Protect "isitontime"
    End If
    End If



    End Sub

  3. #3
    Registered User
    Join Date
    09-08-2014
    Location
    Houston, Texas
    MS-Off Ver
    10
    Posts
    17

    Re: Copy/Paste Values Using VBA Code

    Thank you for the quick response.

    This copies the formula from C and pastes it in D. In other words, it is now taking the left 5 digits of the date. I would like it to paste the values that are in column C, but only if there are values.

    Thank you,

    Daniel

  4. #4
    Registered User
    Join Date
    09-08-2014
    Location
    Houston, Texas
    MS-Off Ver
    10
    Posts
    17

    Re: Copy/Paste Values Using VBA Code

    Here is the answer if anyone else reads this post.

    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. Copy and paste code pasting won't paste just values
    By thehotbreadguy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2013, 11:12 PM
  2. Copy and paste as values in vba loop code
    By Kakkmaddafakka in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-15-2012, 08:24 AM
  3. [SOLVED] Set code copy and paste special values
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-25-2012, 08:52 PM
  4. [SOLVED] Code for Copy and Paste Special- Values in Columns
    By gautamacharya in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2012, 04:51 PM
  5. [SOLVED] code to FIND value, copy, paste values onto other sheet
    By ufo_pilot in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2005, 12:20 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