Consulting

Results 1 to 4 of 4

Thread: Solved: Copying to the next blank cell

  1. #1
    VBAX Regular
    Joined
    Nov 2007
    Posts
    11
    Location

    Solved: Copying to the next blank cell

    I am trying to devise a macro that copies the values from cells P1:P100 (for example) and then find the next blank cell in column B and paste the values from P there.

    Thank you!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    LastRow = Cells(Rows.Count, "B").End(xlUp).Row
    Range("P1:P100").Copy Cells(LastRow+1, "B")
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Nov 2007
    Posts
    11
    Location
    Thanks! What if I want to do the same thing except I want the column P values to be coming from a different worksheet (So I want P1:P100 on sheet1 to be copied to the first blank cell in column D on sheet2).

    Thank you!

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    With Worksheets("Sheet2")
    LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
    Worksheets("Sheet1").Range("P1:P100").Copy .Cells(LastRow+1, "D")
    End With
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •