Page 1 of 4 123 ... LastLast
Results 1 to 10 of 31

Thread: Test

  1. #1

    Test

    These posts are to assist me in answering other Threads

    I hope it is OK for me to do this. Please do not delete"

    Thanks
    Molly







    Testing.

    Black
    BlackAlmost black blue - Darkest Blue in PalletBlack
    BlackDark BlueBlack
    BlackSecond Darkest Blue in PalletBlack
    BlackNavyBlack
    BlackBlueBlack
    BlackForum BlueBlack

    Black
    BlackAlmost black blue - Darkest Blue in PalletBlack
    BlackDark BlueBlack
    BlackSecond Darkest Blue in PalletBlack
    BlackNavyBlack
    BlackBlueBlack
    BlackForum BlueBlack



    Almost black blue - Darkest Blue in PalletNavyAlmost black blue - Darkest Blue in PalletNavyAlmost black blue - Darkest Blue in PalletNavyAlmost black blue - Darkest Blue in Pallet




    from ......... http://www.excelfox.com/forum/showth...=9821#post9821
    http://www.excelfox.com/forum/showth...de-Table/page5
    https://www.excelforum.com/tips-and-...ml#post4642554
    http://www.excelforum.com/the-water-...ml#post4109080
    http://www.excelfox.com/forum/showth...=9821#post9821

    _____ Workbook: LibroSoci.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    1
    2
    3
    Ciao
    4
    Worksheet: LibroSoci



    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://eileenslounge.com/viewtopic.php?p=317218#p317218
    https://eileenslounge.com/viewtopic.php?p=316955#p316955
    https://eileenslounge.com/viewtopic.php?p=316955#p316955
    https://eileenslounge.com/viewtopic.php?p=316940#p316940
    https://eileenslounge.com/viewtopic.php?p=316927#p316927
    https://eileenslounge.com/viewtopic.php?p=317014#p317014
    https://eileenslounge.com/viewtopic.php?p=317006#p317006
    https://eileenslounge.com/viewtopic.php?p=316935#p316935
    https://eileenslounge.com/viewtopic.php?p=316875#p316875
    https://eileenslounge.com/viewtopic.php?p=316254#p316254
    https://eileenslounge.com/viewtopic.php?p=316280#p316280
    https://eileenslounge.com/viewtopic.php?p=315915#p315915
    https://eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315744#p315744
    https://www.eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315680#p315680
    https://eileenslounge.com/viewtopic.php?p=315743#p315743
    https://www.eileenslounge.com/viewtopic.php?p=315326#p315326
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40752
    https://eileenslounge.com/viewtopic.php?p=314950#p314950
    https://www.eileenslounge.com/viewtopic.php?p=314940#p314940
    https://www.eileenslounge.com/viewtopic.php?p=314926#p314926
    https://www.eileenslounge.com/viewtopic.php?p=314920#p314920
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=314837#p314837
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 05-20-2024 at 03:49 PM. Reason: Link corrected

  2. #2
    This post is to help me answering here:

    http://www.excelfox.com/forum/showth...2177#post12177




    Download both uploaded files
    ( Save them in the same place )
    Open file
    OpenAndRunMemacros.xls

    Run macro Sub MeMacroClitbored()

    That should cause the file LibroSoci.xls to be opened. It looks like this
    _____ Workbook: LibroSoci.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    1
    2
    3
    Ciao
    4
    Worksheet: LibroSoci



    That should do _ some things with the variable NTes

    _ The variables contents appear in a message box
    LibroSociMsgBox.JPG : https://imgur.com/pEnKG7u
    LibroSociMsgBox.JPG


    ¬
    _ The code lines,
    rowNo = xlBook.Worksheets("LibroSoci").Range("C:C").Find(What:=NTes, LookIn:=xlValues).Row
    xlBook.Worksheets("LibroSoci").Cells(rowNo, 4) = Year(Date)
    ,
    are used.
    So LibroSoci.xls changes to this:
    UseCodeLine.JPG : https://imgur.com/11g5OHX
    UseCodeLine.jpg


    _____ Workbook: LibroSoci.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    1
    2
    3
    Ciao
    2020
    4
    Worksheet: LibroSoci




    Coding in
    "LibroSoci.xls"

    ThisWorkbookCodeModuleLibroSoci.jpg: https://imgur.com/WYo3jrJ
    ThisWorkbookCodeModuleLibroSoci.jpg

    Code:
    Option Explicit
    Private Sub Workbook_Open()
    'Stop
    Dim objDataObject As Object: Set objDataObject = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
    Dim NTes As String
     objDataObject.GetFromClipboard: Let NTes = objDataObject.GetText()
     MsgBox prompt:=NTes
    Dim xlBook As Workbook
    'Dim xlSheet As Excel.Worksheet
    'Dim xldata As Excel.Range
    'Dim ExcelPath As String
    Dim rowNo As Long
    ' ExcelPath = ThisWorkbook.Path & "\" ' CurrentProject.Path & "\"
    ' Set xlapp = CreateObject("Excel.Application")
    ' Set xlBook = xlapp.Workbooks.Open(ExcelPath & "LibroSoci.xls")
     Set xlBook = ThisWorkbook
    ' Set xlSheet = xlBook.Worksheets("LibroSoci")
    ' xlSheet.Select
    ' xlSheet.Activate
       ' With ActiveSheet
     Let rowNo = xlBook.Worksheets("LibroSoci").Range("C:C").Find(What:=NTes, LookIn:=xlValues).Row
     Let xlBook.Worksheets("LibroSoci").Cells(rowNo, 4).Value = Year(Date)
    '        If Me.Nuova_TessElett <> "" Then
    '            xlBook.Worksheets("LibroSoci").Cells(rowNo, 37) = Me.Nuova_TessElett
    '        End If
       ' End With
    End Sub



    Coding in
    "OpenAndRunMeMacros.xls"

    Code:
    Option Explicit
    Sub MeMacroClitbored()
    Dim NTes As String: Let NTes = "Ciao"
    Dim objDataObject As Object: Set objDataObject = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
     objDataObject.SetText NTes
     objDataObject.PutInClipboard
     Application.OnTime EarliestTime:=Now(), Procedure:="AggiornaLibroSoci"
    End Sub
    Sub AggiornaLibroSoci()
    Dim xlapp As Excel.Application
    Dim xlBook As Excel.Workbook
    'Dim xlSheet As Excel.Worksheet
    'Dim xldata As Excel.Range
    Dim ExcelPath As String
    'Dim rowNo As Long
     Let ExcelPath = ThisWorkbook.Path & "\"  ' CurrentProject.Path & "\"
     Set xlapp = CreateObject("Excel.Application")   
     Let xlapp.Visible = True
     Set xlBook = xlapp.Workbooks.Open(ExcelPath & "LibroSoci.xls")
    ' Set xlSheet = xlBook.Worksheets("LibroSoci")
    ' xlSheet.Select
    ' xlSheet.Activate
    '       ' With ActiveSheet
    '        rowNo = xlBook.Worksheets("LibroSoci").Range("C:C").Find(What:=NTes, LookIn:=xlValues).Row
    '        xlBook.Worksheets("LibroSoci").Cells(rowNo, 4) = Year(Date)
    '    '        If Me.Nuova_TessElett <> "" Then
    '    '            xlBook.Worksheets("LibroSoci").Cells(rowNo, 37) = Me.Nuova_TessElett
    '    '        End If
    '       ' End With
    '     xlBook.Save
     xlBook.Close
     xlapp.Quit
    ' Set xlSheet = Nothing
     Set xlBook = Nothing
     Set xlapp = Nothing
    End Sub
    Attached Files Attached Files
    Last edited by Molly Brennholz; 02-16-2020 at 07:02 PM.

  3. #3
    This post is to help me answering here:

    http://www.excelfox.com/forum/showth...2177#post12177





    It is a similar idea as in the last post. The only difference is that the text information is passed via a text file.

    So as before, both files should be downloaded to the same place.
    File "OpenAndRunMeMacros.xls" should be opened and this time the macro Sub MeMacroTextMies() should be run.
    ( You do not need to do anything about the text file. That will be made the first time Sub MeMacroTextMies() is run , and subsequently it will be overwritten by each further run of Sub MeMacroTextMies(). )

    Sub MeMacroTextMies() running should cause "LibroSociTextMies.xls" to be opened, and as before a similar set of events should take place:
    A message box pops up:
    LibroSociTextMiesMsgBox.JPG : https://imgur.com/5sAvqPP
    LibroSociTextMiesMsgBox.JPG


    and then the file "LibroSociTextMies.xls" is modified:
    UseCodeLine2.JPG : https://imgur.com/SKeW4MQ
    UseCodeLine2.JPG





    Coding in "OpenAndRunMeMacros.xls"
    Code:
    Sub MeMacroTextMies()
    Dim NTes As String: Let NTes = "Ciao"
    Dim strcFileName As String: Let strcFileName = "Timer.txt"
    Dim intFile As Long: Let intFile = FreeFile
    Open ThisWorkbook.Path & "\" & strcFileName For Output As #intFile
    Write #intFile, NTes
    Close intFile
     Application.OnTime EarliestTime:=Now(), Procedure:="AggiornaLibroSociTexties"
    End Sub
    Sub AggiornaLibroSociTexties()
    Dim xlapp As Excel.Application
    Dim xlBook As Excel.Workbook
    Dim ExcelPath As String
     Let ExcelPath = ThisWorkbook.Path & "\"  ' CurrentProject.Path & "\"
     Set xlapp = CreateObject("Excel.Application")
     Let xlapp.Visible = True
     Set xlBook = xlapp.Workbooks.Open(ExcelPath & "LibroSociTextMies.xls")
     xlBook.Close
     xlapp.Quit
    
     Set xlBook = Nothing
     Set xlapp = Nothing
    End Sub
    



    Coding in "LibroSociTextMies.xls"
    Code:
    Option Explicit
    Private Sub Workbook_Open()
    Dim intFile As Long: Let intFile = FreeFile
    Dim strcFileName As String: Let strcFileName = "Timer.txt"
    Open ThisWorkbook.Path & "\" & strcFileName For Input As #intFile
    Dim NTes As String
    Input #intFile, NTes
    Close intFile
     MsgBox prompt:=NTes
    Dim xlBook As Workbook
    Dim rowNo As Long
     Set xlBook = ThisWorkbook
     Let rowNo = xlBook.Worksheets("LibroSoci").Range("C:C").Find(What:=NTes, LookIn:=xlValues).Row
     Let xlBook.Worksheets("LibroSoci").Cells(rowNo, 4).Value = Year(Date)
    End Sub
    Attached Files Attached Files
    Last edited by Molly Brennholz; 02-13-2020 at 02:12 AM.

  4. #4
    Quote Originally Posted by DocAElstein View Post
    ... Feeling horny..
    C ja later
    x

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://eileenslounge.com/viewtopic.php?p=317218#p317218
    https://eileenslounge.com/viewtopic.php?p=316955#p316955
    https://eileenslounge.com/viewtopic.php?p=316955#p316955
    https://eileenslounge.com/viewtopic.php?p=316940#p316940
    https://eileenslounge.com/viewtopic.php?p=316927#p316927
    https://eileenslounge.com/viewtopic.php?p=317014#p317014
    https://eileenslounge.com/viewtopic.php?p=317006#p317006
    https://eileenslounge.com/viewtopic.php?p=316935#p316935
    https://eileenslounge.com/viewtopic.php?p=316875#p316875
    https://eileenslounge.com/viewtopic.php?p=316254#p316254
    https://eileenslounge.com/viewtopic.php?p=316280#p316280
    https://eileenslounge.com/viewtopic.php?p=315915#p315915
    https://eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315744#p315744
    https://www.eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315680#p315680
    https://eileenslounge.com/viewtopic.php?p=315743#p315743
    https://www.eileenslounge.com/viewtopic.php?p=315326#p315326
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40752
    https://eileenslounge.com/viewtopic.php?p=314950#p314950
    https://www.eileenslounge.com/viewtopic.php?p=314940#p314940
    https://www.eileenslounge.com/viewtopic.php?p=314926#p314926
    https://www.eileenslounge.com/viewtopic.php?p=314920#p314920
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=314837#p314837
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 05-20-2024 at 03:51 PM.

  5. #5
    Screenshots I need to help answer the post that is just here:
    http://www.excelfox.com/forum/showth...-to-put-remark

    If column I is sell then see the value of column K & if column K is Greater than sheet2 of column E then put the remark in sheet3 in the stock name from column B
    If column I is buy then see the value of column K & if column K is lower than sheet2 of column F then put the remark in sheet3 in the stock name from column B
    remark will be in series like 1,2,3,4,5,6 and so on
    vba is palced in a separate file
    all files are located in same place
    and after putting the remark clear sheet 1 and sheet 2


    If column I is sell then see the value of column K &
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    1
    Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    2
    NSE ACC EQ
    10
    11
    12
    13
    8
    SELL
    11.247
    1100.947
    3
    NSE ADANIENT EQ
    8
    7
    6
    5
    4
    BUY
    1.334
    130.734
    4
    Worksheet: Sheet1


    if column K is Greater than sheet2 of column E
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    1
    Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    2
    NSE ACC EQ
    1
    1102
    18
    4
    2
    3
    NSE ADANIENT EQ
    5
    6
    129
    8
    4
    4
    Worksheet: Sheet2

    E then put the remark in sheet3 in the stock name from column B
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    1
    Symbol
    2
    ACC
    1
    2
    3
    3
    ADANIENT
    1
    4
    5
    6
    7
    remark I have puuted 1 bcoz series start with 1
    8
    and next time when I will run the macro
    9
    then it will start with 2
    10
    and again when I will ran the macro then it will start with 3
    Worksheet: Sheet3

    If column I is buy then see the value of column K & if column K is lower than sheet2 of column F then put the remark in sheet3 in the stock name from column B
    remark will be in series like 1,2,3,4,5,6 and so on
    vba is palced in a separate file
    all files are located in same place
    and after putting the remark clear sheet 1 and sheet 2

    arrS1()
    Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    NSE ACC EQ
    10
    11
    12
    13
    8
    SELL
    11.247
    1100.947
    NSE ADANIENT EQ
    8
    7
    6
    5
    4
    BUY
    1.334
    130.734



    arrS2()
    Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    NSE ACC EQ
    1
    1102
    18
    4
    2
    NSE ADANIENT EQ
    5
    6
    129
    8
    4


    arrS3()
    Symbol
    ACC
    1
    2
    3
    ADANIENT
    1

    Symbol
    ACC
    1
    2
    3
    ADANIENT
    1






    Your data ?????
    SELL is K=1100.947 , sheet 2 column E is 1102 … so K is NOT > column E ---- so no output – no remark
    BUY is K = 130.734 , sheet 2 column E is 129 … so K is NOT < column E ----- so no output – no remark



    _.....see next post............._
    Last edited by Molly Brennholz; 03-20-2020 at 12:52 PM.

  6. #6
    _...........from last post

    Try this data:


    _____ Workbook: Merge2.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    1
    Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    2
    NSE ACC EQ
    10
    11
    12
    13
    8
    SELL
    11.247
    1234
    3
    NSE ADANIENT EQ
    8
    7
    6
    5
    4
    BUY
    1.334
    125
    4
    Worksheet: Sheet1





    Code:
    Option Explicit
    Sub HidnInLisWb() '
    Rem 1 Worksheets info
    Dim Wbm As Workbook, Ws1 As Worksheet, Ws2 As Worksheet, Ws3 As Worksheet
     Set Wbm = Workbooks("Merge2.xls")
     Set Ws1 = Wbm.Worksheets("Sheet1"): Set Ws2 = Wbm.Worksheets("Sheet2"): Set Ws3 = Wbm.Worksheets("Sheet3")
    Rem 2 data Input
    Dim arrS1() As Variant, arrS2() As Variant, arrS3() As Variant
     Let arrS1() = Ws1.Range("A1").CurrentRegion.Value: arrS2() = Ws2.Range("A1").CurrentRegion.Value
    '2b
     ReDim arrS3(1 To UBound(arrS1(), 1)) ' A 1 dimension array of arrays
    ''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(arrS1(), 1) '  "row" count, cnt
        '2b)(ii)
        Dim Lc As Long: Let Lc = Ws3.Cells.Item(cnt, Ws3.Cells.Columns.Count).End(xlToLeft).Column ' last column in this row cnt
         Let arrS3(cnt) = Ws3.Range("A" & cnt & ":" & CL(Lc + 1) & cnt & "").Value ' - returns an array of 1 "row" into this element of the array of arrays
         Select Case arrS1(cnt, 9) ' column I
          Case "SELL" 'If column I is sell
            If arrS1(cnt, 11) > arrS2(cnt, 5) Then ' if column K is Greater than sheet2 of column E then
             Let arrS3(cnt)(1, UBound(arrS3(cnt), 2)) = UBound(arrS3(cnt), 2) - 1 ' Put in a value in last array "column"
            Else
            End If
          Case "BUY"  'If column I is buy
           If arrS1(cnt, 11) < arrS2(cnt, 6) Then  ' if column K is lower than sheet2 of column F then
            Let arrS3(cnt)(1, UBound(arrS3(cnt), 2)) = UBound(arrS3(cnt), 2) - 1 ' Put in a value in last array "column"
           Else
           End If
         End Select
        '3b) output "row"
         Let Ws3.Range("A" & cnt & "").Resize(1, Lc + 1).Value = arrS3(cnt)
        Next cnt
    Rem 4    ....and after putting the remark clear sheet 1 and sheet 2
     Ws1.cells.Clear
     Ws2.cells.Clear
    End Sub
    
    'If column I is sell
    'then see the value of column K &
    'if column K is Greater than sheet2 of column E then put the remark in sheet3 in the stock name from column B
    
    'If column I is buy
    'see the value of column K &
    'if column K is lower than sheet2 of column F then put the remark in sheet3 in the stock name from column B
    'remark will be in series like 1,2,3,4,5,6 and so on
    'vba is palced in a separate file
    'all files are located in same place
    'and after putting the remark clear sheet 1 and sheet 2
    
    
    
    '     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
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://eileenslounge.com/viewtopic.php?p=317218#p317218
    https://eileenslounge.com/viewtopic.php?p=316955#p316955
    https://eileenslounge.com/viewtopic.php?p=316955#p316955
    https://eileenslounge.com/viewtopic.php?p=316940#p316940
    https://eileenslounge.com/viewtopic.php?p=316927#p316927
    https://eileenslounge.com/viewtopic.php?p=317014#p317014
    https://eileenslounge.com/viewtopic.php?p=317006#p317006
    https://eileenslounge.com/viewtopic.php?p=316935#p316935
    https://eileenslounge.com/viewtopic.php?p=316875#p316875
    https://eileenslounge.com/viewtopic.php?p=316254#p316254
    https://eileenslounge.com/viewtopic.php?p=316280#p316280
    https://eileenslounge.com/viewtopic.php?p=315915#p315915
    https://eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315744#p315744
    https://www.eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315680#p315680
    https://eileenslounge.com/viewtopic.php?p=315743#p315743
    https://www.eileenslounge.com/viewtopic.php?p=315326#p315326
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40752
    https://eileenslounge.com/viewtopic.php?p=314950#p314950
    https://www.eileenslounge.com/viewtopic.php?p=314940#p314940
    https://www.eileenslounge.com/viewtopic.php?p=314926#p314926
    https://www.eileenslounge.com/viewtopic.php?p=314920#p314920
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=314837#p314837
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 05-20-2024 at 03:48 PM.

  7. #7
    From last post

    Code:
     _____ Workbook: Merge2.xls ( Using Excel 2007 32 bit )
    
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    1
    Symbol = arrS3(1) arrS3(1)(1, UBound(arrS3(1), 2)) = Symbol
    2
    ACC
    1
    2
    3
    = arrS3(2) arrS3(2)(1, UBound(arrS3(2), 2)) =
    3
    3
    ADANIENT
    1
    = arrS3(2) arrS3(3)(1, UBound(arrS3(3), 2)) =
    1
    4
    5
    6
    7
    remark I have puuted 1 bcoz series start with 1
    8
    and next time when I will run the macro
    9
    then it will start with 2
    10
    and again when I will ran the macro then it will start with 3
    11
    12
    arrS3()= { arrS3(1) , arrS3(2) , arrS3(3) }
    13
    14
    15
    16
    17
    18
    19
    20
    arrS3(cnt)(1, UBound(arrS3(cnt), 2)) =
    21
    22
    Worksheet: Sheet3 (2)


    _____ Workbook: Merge2.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    1
    Symbol = arrS3(1) arrS3(1)(1, UBound(arrS3(1), 2)) = Symbol
    2
    ACC
    1
    2
    3
    = arrS3(2) arrS3(2)(1, UBound(arrS3(2), 2)) =
    3
    3
    ADANIENT
    1
    = arrS3(2) arrS3(3)(1, UBound(arrS3(3), 2)) =
    1
    4
    5
    6
    7
    remark I have puuted 1 bcoz series start with 1
    8
    and next time when I will run the macro
    9
    then it will start with 2
    10
    and again when I will ran the macro then it will start with 3
    11
    12
    arrS3()= { arrS3(1) , arrS3(2) , arrS3(3) }
    13
    14
    15
    16
    17
    18
    19
    20
    arrS3(cnt)(1, UBound(arrS3(cnt), 2)) =
    21
    22
    Worksheet: Sheet3 (2)
    Attached Files Attached Files

  8. #8
    Some notes to help me in solving this Thread:
    http://www.excelfox.com/forum/showth...te-conditional

    _____ Workbook: 1.xlsx ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    1
    NSE
    25
    6
    >
    50000
    A GTT
    2
    NSE
    22
    6
    >
    10000
    A GTT
    3
    NSE
    15083
    6
    >
    70000
    A GTT
    4
    NSE
    17388
    6
    >
    20000
    A GTT
    5
    NSE
    100
    6
    >
    170000
    A GTT
    6
    Worksheet: Sheet1 (4)

    If column B of 2.xlsm match with column B of 1.xls then paste the data from column C of 2.xls as 1,2,3,4,5 and so on....
    &
    If column B of 2.xlsm doesn't match with column B of 1.xls then delete all the data from column C of that row


    _____ Workbook: 2.xlsm ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    1
    Symbol
    2
    ACC
    22
    1
    2
    3
    ADANIENT
    25
    1
    4
    ADANIPORTS
    15083
    1
    2
    3
    5
    ADANIPOWER
    17388
    1
    2
    3
    4
    5
    6
    AMARAJABAT
    100
    1
    2
    3
    4
    7
    ASIANPAINT
    236
    1
    2
    8
    9
    10
    11
    12
    cells highlighted in red colour doesn’t match with 1.xls show the data from column C will be cleared so 1,2 will be erased
    13
    cells highlighted in green colour matches with 1.xls show we will paste the data from column C
    but if column C has data then we will paste to column D
    and if column D also has data then column E and so on….
    14
    highlighted colour is only for understanding purpose in actual file there will not be any highlighted colour data
    15
    Worksheet: Sheet1
    Last edited by Molly Brennholz; 04-29-2020 at 03:02 PM.

  9. #9
    Continued from previous post
    Some notes to help me in solving this Thread:
    http://www.excelfox.com/forum/showth...te-conditional


    I will answer this similar to the last question for consistency to help in understanding, and also do it in a way that might not be the most efficient, but may help in further modifications or similar requirements that I would not be surprised might follow…

    Regardless of, and before any checks for meeting the match criteria are done I will make an array of arrays as previously, arr3()
    This will be a one dimensional array. For the test data from the previous post this will have a size of 6 main elements, ( 7 incl. Header - arr3(0) not used ) , each of which is a single row, 2 dimensional array of the original data in 2.xlsm with the addition of an extra last element.
    ACC
    22
    1
    2
    3

    ADANIENT
    25
    1
    2

    ADANIPORTS
    15083
    1
    2
    3
    4

    ADANIPOWER
    17388
    1
    2
    3
    4
    5
    6

    AMARAJABAT
    100
    1
    2
    3
    4
    5

    ASIANPAINT
    236
    1
    2
    3


    [ _____ Workbook: 2.xlsm ( Using Excel 2007 32 bit )
    arr3() = { arr3(1) , arr3(2) , arr3(3) , arr3(4) , arr3(5) , arr(6) }
    arr3(1) = ACC
    22
    1
    2
    3
    arr3(2) = ADANIENT
    25
    1
    2
    arr3(3) = ADANIPORTS
    15083
    1
    2
    3
    4
    arr3(4) = ADANIPOWER
    17388
    1
    2
    3
    4
    5
    6
    arr3(5) = AMARAJABAT
    100
    1
    2
    3
    4
    5
    arr3(6) = ASIANPAINT
    236
    1
    2
    3
    Last edited by Molly Brennholz; 04-29-2020 at 03:25 PM.

  10. #10
    Macro for
    http://www.excelfox.com/forum/showth...te-conditional




    Code:
    '  http://www.excelfox.com/forum/showthread.php/2465-copy-paste-conditional
    
    
    Sub CopyPasterConditionalToPutRemark_1_2_3_etc() '
    Rem 1 Worksheets info
    Dim Wb1 As Workbook, Wb2 As Workbook, Ws1 As Worksheet, Ws2 As Worksheet
     Set Wb1 = Workbooks("1.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 from the 3rd up to the last element need to be rtemoved from the array for this row
            Dim Empt As Long
                For Empt = 3 To UBound(arr3(Cnt - 1), 2)
                 Let arr3(Cnt - 1)(1, Empt) = ""
                Next Empt
            Else
            ' a match was found, so we do not need to remove the  1   2   3   etc...
            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





    Share ‘1.xlsx’ : https://app.box.com/s/0yc8icxb03i4vs1h11n20l43frmd52qa
    Share ‘2.xlsm’ : https://app.box.com/s/ry312xpb04kwef4wufvvx54qpv1mwai0
    Last edited by Molly Brennholz; 04-29-2020 at 05:05 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
  •