+ Reply to Thread
Results 1 to 2 of 2

NEED HELP ASAP - probably easy for competent users

  1. #1
    Registered User
    Join Date
    12-23-2015
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    14

    NEED HELP ASAP - probably easy for competent users

    Sub RangeCopyPaste()
    Dim cell As Range
    Dim NewRange As Range
    Dim MyCount As Long
    MyCount = 1
    Dim cell2 As Range
    Dim NewRange2 As Range
    Dim MyCount2 As Long
    MyCount2 = 1
    Dim cell3 As Integer
    Dim NewRange3 As Range
    Dim MyCount3 As Long
    MyCount3 = 1
    Dim myarray As Variant
    Dim myarray2 As Variant


    For Each cell In Worksheets("Raw Data").Range("I:I")
    If cell.Value = "BM" Then
    If MyCount = 1 Then Set NewRange = cell.Offset(0, -5)
    Set NewRange = Application.Union(NewRange, cell.Offset(0, -5))
    MyCount = MyCount + 1
    End If
    Next cell

    For Each cell2 In Worksheets("Product List").Range("E:E")
    If cell2.Value = "Product" Then
    If MyCount2 = 1 Then Set NewRange2 = cell2.Offset(0, -4)
    Set NewRange2 = Application.Union(NewRange2, cell2.Offset(0, -4))
    MyCount2 = MyCount2 + 1
    End If
    Next cell2



    --> I know up to here works. I'm trying to create two Arrays for the dataset of NewRange and NewRange2. Then wanna compare each piece of data of NewRange to all the data in NewRange2 if it its a match copy the data from NewRange that matched onto a worksheet. <--




    myarray = Array(NewRange2.Range(MyCount2)) <--- error
    myarray2 = Array(NewRange.Range(MyCount)) <--- error


    For cell3 = 1 To UBound(myarray2)
    If Cells(cell3, 1) = Filter(myarray, cell3) Then
    If MyCount3 = 1 Then Set NewRange3 = Cells(cell3, 1)
    Set NewRange3 = Application.Union(NewRange3, Cells(cell3, 1))
    MyCount3 = MyCount3 + 1
    End If
    Next cell3


    NewRange3.Copy Destination:=Worksheets("Services").Range("C11")

    End Sub

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: NEED HELP ASAP - probably easy for competent users

    Welcome to the board.

    Please take a few minutes to read the forum rules, and then edit your post to amend your thread title accordingly and add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hello from a competent but not expert Excel User...
    By BonnieRionda in forum Hello..Introduce yourself
    Replies: 3
    Last Post: 04-03-2014, 05:39 AM
  2. Dangerously Competent
    By BAM475294 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 08-27-2013, 01:40 PM
  3. Need an easy way to seggregate this file accordingly asap
    By chandannasta in forum Excel General
    Replies: 14
    Last Post: 08-16-2013, 05:32 PM
  4. Need an easy way to present this in a good manner asap
    By chandannasta in forum Excel General
    Replies: 4
    Last Post: 08-02-2013, 02:09 PM
  5. Replies: 28
    Last Post: 05-31-2012, 02:37 PM
  6. Replies: 1
    Last Post: 07-25-2007, 04:02 PM
  7. competent excel programmer in Elmira, NY area?
    By wrpalmer in forum Excel General
    Replies: 0
    Last Post: 11-04-2005, 07:13 AM

Tags for this Thread

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