+ Reply to Thread
Results 1 to 5 of 5

copy the first or target cell and paste it onto the next cell(s) below

Hybrid View

  1. #1
    Registered User
    Join Date
    03-15-2016
    Location
    manila, philippines
    MS-Off Ver
    2013
    Posts
    3

    copy the first or target cell and paste it onto the next cell(s) below

    Hi! I am currently working on a project that will copy the first cell or target cell and paste it onto the next cell(s) until it reaches a cell with value. I am actually new in excel programming and i have a little bit of knowledge with. hope to get an answer from this forum. Thank you in advance!

  2. #2
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: copy the first or target cell and paste it onto the next cell(s) below

    Not much to go on but assuming you target cell is in "A1" and that you want to loop down or by rows, add the following code to the Worksheet module...

    Option Explicit 'keeps you from making simple mistakes
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim i As Integer
    If Target.Address = "A1" Then 'replace "A1" with you target cell
        For i = 1 To 100 'begin loop from Start row to end row number
            If ActiveSheet.Cells(i, 1) = "" Then     'If the next cell is blank then...(.Cells(row,column)...1 is column A and B=2, and C=3 etc...replace with whatever column works for your application
                ActiveSheet.Cells(i, 1) = Target.Value
            Else ' if the next cell does contain a value
                Exit For 'exit the loop
            End If
        Next i
        
    End Sub
    If your questions has been answered to your satisfaction please don't forget to do the following:

    Add Reputation ... and ... Mark Thread as Solved

    Thanks,

    Ma 10:8b Freely you have received; freely give.

  3. #3
    Registered User
    Join Date
    03-15-2016
    Location
    manila, philippines
    MS-Off Ver
    2013
    Posts
    3

    Re: copy the first or target cell and paste it onto the next cell(s) below

    Hi! I don't know why but I can't upload the file so please bear with me. thank you again! so basically, I want to copy the year
    2017 and paste it onto the next cell below it until it reaches the year 2018.sample.PNG
    Last edited by newguyexcelboy; 03-15-2016 at 10:18 PM.

  4. #4
    Registered User
    Join Date
    03-15-2016
    Location
    manila, philippines
    MS-Off Ver
    2013
    Posts
    3

    Re: copy the first or target cell and paste it onto the next cell(s) below

    thank you for your reply. will try it as soon as possible.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: copy the first or target cell and paste it onto the next cell(s) below

    Welcome to the forum
    Can you upload sample workbook to find solutions quickly?
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

+ 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. Macro to copy row if target cell is not blank
    By john_matta in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-09-2016, 11:25 PM
  2. Replies: 5
    Last Post: 01-22-2013, 11:38 AM
  3. Replies: 1
    Last Post: 10-28-2012, 01:13 AM
  4. Replies: 1
    Last Post: 10-14-2012, 09:25 AM
  5. Cut unique value from ComboBox list and paste in target cell
    By Trompie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2012, 01:42 AM
  6. Copy data but leave target cell blank
    By MarcoAUA in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2012, 02:27 PM
  7. copy paste problem if target cell contains formula
    By masterx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-23-2010, 06:20 AM

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