Results 1 to 10 of 31

Thread: Test

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Full macro for this post,

    Sub CopyPasterConditionalToPutRemark_1_2_3_etcArseOverTit()

    Code:
    '  http://www.excelfox.com/forum/showthread.php/2465-copy-paste-conditional
    
    '  http://www.excelfox.com/forum/showthread.php/2465-copy-paste-conditional?p=13175&viewfull=1#post13175
    Sub CopyPasterConditionalToPutRemark_1_2_3_etcArseOverTit() '
    Rem 1 Worksheets info
    Dim Wb1 As Workbook, Wb2 As Workbook, Ws1 As Worksheet, Ws2 As Worksheet
     Set Wb1 = Workbooks("1 1Mai.xlsx")
     Set Wb2 = ThisWorkbook   '   macro will be placed in 2.xlsm
     Set Ws1 = Wb1.Worksheets.Item(1): Set Ws2 = Wb2.Worksheets.Item(1)
    Rem 2 data Input
    Dim arr1() As Variant, arr2() As Variant, arr3() As Variant
     Let arr1() = Ws1.Range("A1:K" & Ws1.Range("A1").CurrentRegion.Rows.Count & "").Value
     Let arr2() = Ws2.Range("A1").CurrentRegion.Value                                     ' Current region will not work for arrS1() because columns G to J are empty
    '2b
     ReDim arr3(0 To UBound(arr2(), 1)) ' A 1 dimension array of arrays , ( the first element arr3(0) we will not use )
    ''2b(i)
    ' Let arrS3(1) = Ws3.Range("A" & Ws3.Range("A1").CurrentRegion.Columns.Count & "") ' header row as a one dimensional array
    ''2b(ii) data rows array output
    Rem 3
    Dim Cnt
        For Cnt = 2 To UBound(arr2(), 1) '  "row" count, Cnt from after heading untill last row in  2.xlsm ( Ws2 )
        '2b)(ii) make and fill the row element array inside the current arr3(cnt) element
        Dim Lc As Long: Let Lc = Ws2.Cells.Item(Cnt, Ws2.Cells.Columns.Count).End(xlToLeft).Column ' last column in this row cnt
         Let arr3(Cnt - 1) = Ws2.Range("A" & Cnt & ":" & CL(Lc + 1) & Cnt & "").Value ' - returns an array of 1 "row" into this element of the array of arrays. It has one more element than filled columns - this empty last element is filled in the next line
         Let arr3(Cnt - 1)(1, UBound(arr3(Cnt - 1), 2)) = UBound(arr3(Cnt - 1), 2) - 2 ' this puts the next integer in the last, currently empty element
        '3a) Check for match criteria
        Dim mtchRes As Variant
         Let mtchRes = Application.Match(arr2(Cnt, 2), Ws1.Range("B1:B" & UBound(arr1(), 1) & ""), 0)
            If IsError(mtchRes) Then  '  If the last line errored than we did not find a match, so we do not need to  do anything to the array
            ' a match was not found, so we do not need to remove the  1   2   3   etc...
            Else
            ' a match was found, so we need to remove the  1   2   3   etc...
            Dim Empt As Long
                For Empt = 3 To UBound(arr3(Cnt - 1), 2)
                 Let arr3(Cnt - 1)(1, Empt) = ""
                Next Empt
            End If
        '3c) Paste out row
         Let Ws2.Range("A" & Cnt & "").Resize(1, Lc + 1).Value = arr3(Cnt - 1)
        Next Cnt
                                                                                                                            Rem 4    ....and after putting the remark clear sheet 1 and sheet 2
                                                                                                                            ' Ws1.Cells.Clear
                                                                                                                            ' Ws2.Cells.Clear
    End Sub
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    '     http://www.excelfox.com/forum/showthread.php/1546-TESTING-Column-Letter-test-Sort
    Public Function CL(ByVal lclm As Long) As String '         http://www.excelforum.com/development-testing-forum/1101544-thread-post-appendix-no-reply-needed-please-do-not-delete-thanks-4.html#post4213980
        Do: Let CL = Chr(65 + (((lclm - 1) Mod 26))) & CL: Let lclm = (lclm - (1)) \ 26: Loop While lclm > 0
    End Function
    
    Attached Files Attached Files
    Last edited by Molly Brennholz; 05-01-2020 at 06:23 PM.

Similar Threads

  1. Test
    By DocAElstein in forum Test Area
    Replies: 0
    Last Post: 03-30-2020, 07:20 PM
  2. test
    By EFmanagement in forum Test Area
    Replies: 0
    Last Post: 09-29-2019, 11:01 PM
  3. This is a test Test Let it be
    By Admin in forum Test Area
    Replies: 6
    Last Post: 05-30-2014, 09:44 AM
  4. Test
    By Excel Fox in forum Den Of The Fox
    Replies: 0
    Last Post: 07-31-2013, 08:15 AM
  5. Test
    By Excel Fox in forum Word Help
    Replies: 0
    Last Post: 07-05-2011, 01:51 AM

Posting Permissions

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