Results 1 to 2 of 2

Vba to insert value before copying over to new sheet

Threaded View

Sintek Vba to insert value before... 09-08-2016, 08:11 AM
jaslake Re: Vba to insert value... 09-08-2016, 04:55 PM
  1. #1
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,964

    Vba to insert value before copying over to new sheet

    Hi All

    I have the below code which copies a row with certain criteria to another sheet and then deletes that row. How can I add to the code to do the following:

    Before it copies and pastes to new sheet, It must insert "COD" into column F of each row that meets the criteria


    Sub Move()
    Dim TRow As String
    Dim myrange As Range
    Sheets("Temp").Select
    TRow = "20160908286"
    Set myrange = Sheets("Temp").Range("B2", Range("B" & Rows.Count).End(xlUp))
    For Each cell In myrange
        If cell.Value = TRow Then
            lr = Sheets("Hist").Range("B" & Rows.Count).End(xlUp).Row
            cell.EntireRow.Copy Destination:=Sheets("Hist").Range("A" & lr + 1)
            cell.EntireRow.Delete xlShiftUp
            End If
    Next cell
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copying & pasting a current region to another sheet w/o actually copying.....
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2014, 09:08 PM
  2. Macro for copying the data from one sheet and insert the same in next sheet
    By Thinker8 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2013, 05:51 PM
  3. [SOLVED] VBA codes to insert the rows and copy the first entire row text and insert sheet
    By PRADEEPB270 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-26-2013, 05:05 AM
  4. [SOLVED] Code from tigeravatar ,Copying data from one sheet and copying it
    By DanielRay in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-07-2012, 03:07 PM
  5. [SOLVED] Copying a sheet without copying the command buttons
    By LeapingLizard in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 10-27-2012, 09:17 AM
  6. Copy Sheet / Create & Name New Sheet / Insert Before a Sheet / Paste Data
    By thinkspac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2012, 02:27 PM
  7. Insert row not copying all my calculations
    By freezer in forum Excel General
    Replies: 1
    Last Post: 03-11-2007, 02:02 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