Results 1 to 2 of 2

Thread: [RESOLVED] Excel Copy Paste Problem

  1. #1

    Thread Starter
    Addicted Member allankevin's Avatar
    Join Date
    Jul 2008
    Posts
    173

    Resolved [RESOLVED] Excel Copy Paste Problem

    Hi Guys,

    I have a problem to this code. whenever I move the data it will paste 22 set of rows to OSRF Tracker ver1 0.xls.. instead of only 1 row. the code with the red font is the code im talking about..

    Code:
    Private Sub CommandButton1_Click()
    
    Dim i As Integer ' counter
    Dim results As Integer
    
    
       
    results = MsgBox("Are you sure you want to Log this record?", vbYesNo, "")
    If results = vbYes Then
       
    Workbooks.Open "C:\Documents and Settings\LimA1\Desktop\OSRF Tracker ver1 0.xls"
    
    With Workbooks("OSRF Tracker ver1 0.xls").Sheets("Data")
    
        i = .Cells(Rows.Count, "B").End(xlUp).Row + 1
        
        .Range("B2:F2" & i).Value = Workbooks("OSRF(ver3.0).xls").Sheets("Sheet1").Range("D10:H10").Value
        .Range("G" & i).Value = Workbooks("OSRF(ver3.0).xls").Sheets("Sheet1").Range("I5").Value
        .Range("I" & i).Value = Workbooks("OSRF(ver3.0).xls").Sheets("Sheet1").Range("E38").Value
        .Range("J" & i).Value = Workbooks("OSRF(ver3.0).xls").Sheets("Sheet1").DTPicker1.Value
        .Range("K" & i).Value = Workbooks("OSRF(ver3.0).xls").Sheets("Sheet1").DTPicker2.Value
        
     End With
      
    End If
    Thanks and Regards,

    kevin
    "In order to improve the mind, we ought less to learn, than to contemplate."

  2. #2

    Thread Starter
    Addicted Member allankevin's Avatar
    Join Date
    Jul 2008
    Posts
    173

    Re: Excel Copy Paste Problem

    yey it should be like this Case Solved!

    Code:
    .Range("B" & i & ":F" & i).Value = Workbooks("OSRF(ver3.0).xls").Sheets("Sheet1").Range("D10:H10").Value
    "In order to improve the mind, we ought less to learn, than to contemplate."

Posting Permissions

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



Click Here to Expand Forum to Full Width