Closed Thread
Results 1 to 2 of 2

Please quick help needed

Hybrid View

reddys0909 Please quick help needed 03-14-2013, 08:55 AM
arlu1201 Re: Please quick help needed 03-14-2013, 08:57 AM
  1. #1
    Registered User
    Join Date
    03-12-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    7

    Question Please quick help needed

    Need help to include one condition to check if the sheet 2 data which is inserting into sheet 3 is not same, if same then it should not include row in sheet 3.

    e.g. Sheet 2 is a Pivot table data and sheet 3 I am accumulating data to use in Vlookup in the sheet 1.

    sheet2 Column J row 2,3,4,5...14 which is then inserted into sheet 3 Column C Row 2 .... Column K Row 2. When I execute below macro it is inserting but it is missing condition to make sure same data is not inserted.


    Public Sub CopyData()
    Dim ws As Worksheet, bi As Byte, vData(1 To 9), bi1 As Byte, vData1(1 To 9), bi2 As Byte, vData2(1 To 9), bi3 As Byte, vData3(1 To 9), bi4 As Byte, vData4(1 To 9)
    Set ws = Sheets("Sheet2")
    For bi = 1 To 9
        vData(bi) = Application.Choose(bi, ws.Range("J6"), ws.Range("J7"), ws.Range("J8"), ws.Range("J9"), ws.Range("J10"), ws.Range("J11"), ws.Range("J12"), ws.Range("J13"), ws.Range("J14"))
    Next bi
    Sheets("Sheet3").Cells(Rows.Count, "C").End(xlUp).Offset(1).Resize(, 9).Value = vData
    For bi1 = 1 To 9
        vData1(bi1) = Application.Choose(bi1, ws.Range("H6"), ws.Range("H7"), ws.Range("H8"), ws.Range("H9"), ws.Range("H10"), ws.Range("H11"), ws.Range("H12"), ws.Range("H13"), ws.Range("H14"))
    Next bi1
    Sheets("Sheet3").Cells(Rows.Count, "C").End(xlUp).Offset(1).Resize(, 9).Value = vData1
    For bi2 = 1 To 9
        vData2(bi2) = Application.Choose(bi2, ws.Range("I6"), ws.Range("I7"), ws.Range("I8"), ws.Range("I9"), ws.Range("I10"), ws.Range("I11"), ws.Range("I12"), ws.Range("I13"), ws.Range("I14"))
    Next bi2
    Sheets("Sheet3").Cells(Rows.Count, "C").End(xlUp).Offset(1).Resize(, 9).Value = vData2
    For bi3 = 1 To 9
        vData3(bi3) = Application.Choose(bi3, ws.Range("G6"), ws.Range("G7"), ws.Range("G8"), ws.Range("G9"), ws.Range("G10"), ws.Range("G11"), ws.Range("G12"), ws.Range("G13"), ws.Range("G14"))
    Next bi3
    Sheets("Sheet3").Cells(Rows.Count, "C").End(xlUp).Offset(1).Resize(, 9).Value = vData3
    For bi4 = 1 To 9
        vData4(bi4) = Application.Choose(bi4, ws.Range("D6"), ws.Range("D7"), ws.Range("D8"), ws.Range("D9"), ws.Range("D10"), ws.Range("D11"), ws.Range("D12"), ws.Range("D13"), ws.Range("D14"))
    Next bi4
    Sheets("Sheet3").Cells(Rows.Count, "C").End(xlUp).Offset(1).Resize(, 9).Value = vData4
    Set ws = Nothing
    
    End Sub

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Please quick help needed

    Your thread title does not comply with forum rules.

    Also,

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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