Consulting

Results 1 to 5 of 5

Thread: Pasting to the next row in a list

  1. #1

    Pasting to the next row in a list

    Hi everyone,

    I'm trying my best to learn VBA but I'm stuck with a problem that shouldn't take too long to figure out. Basically I want to past a range of cells from the newest worksheet into a summary list. This data needs to be pasted to the bottom of the list. I was trying to count the number of rows, and then add that value to the starting row to get the next row that doesn't have a value in it. Heres my code for the part that I'm stuck on, I know the snytax is not right, but hopefully it will give you an idea what I'm trying to accomplish.

    Sub Update()
    Sheets(2).Select
    ActiveSheet.Unprotect
    Range("P27:W27").Select
    Selection.Copy
    Sheets(1).Select
    h = Range("B113").Value
    Range("B" & "72+h").Select

    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks :=False, Transpose:=False
    End Sub

    Thanks for any help you can give. I'm not sure if this is even the right way to got about this situation, so I'm open to any suggestions. Thanks

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

    Sub Update()
    With Sheets(2)
    .Unprotect
    .Range("P27:W27").Copy
    Sheets(1).Range("B1").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
    .Protect
    End With
    End Sub
    [/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
    Is there any way to use the code to paste to the bottom of the list. When I added to code to my macro it copies to the top of the list.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Do you have some gaps in the list?
    ____________________________________________
    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

  5. #5
    Sorry I just had to adjust the cell range, it works perfectly thanks

Posting Permissions

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