Results 1 to 4 of 4

Thread: Inquiry: VBA Code in Excel

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Inquiry: VBA Code in Excel

    Hi everyone,

    I have a form in the sheet1 where I have fields that are filled out with vlookup function. I want to copy or save the value of the fields in a row. The code worked perfect, but the only thing it is copying in the same sheet where the fields are located. I want to copy and paste the values in the Sheet2 instead of Sheet1. I tried to change ActiveSheet.Cells to Sheet2.Cells, but it does not work. Can you help me on this?

    Public Sub PasteData()
    Dim PCount As Integer
    Cells(1, 2).Select
    PCount = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1
    Cells(PCount, 1).Value = "Par1"
    Cells(PCount, 2).Value = "Par2"
    Cells(PCount, 3).Value = "Par3"
    Cells(PCount, 4).Value = "Par4"
    Cells(PCount, 5).Value = "Par5"
    
    End Sub
    Last edited by Aussiebear; 09-11-2013 at 03:18 PM. Reason: Added tags to code

Posting Permissions

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