Page 40 of 57 FirstFirst ... 30383940414250 ... LastLast
Results 391 to 400 of 565

Thread: Tests Copying, Pasting, API Cliipboard issues. and Rough notes on Advanced API stuff

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    Links relavent to the last 9 posts

    Code:
    ' https://www.excelforum.com/excel-programming-vba-macros/1338596-transferring-data.html#post5458446
    ' _  First i wanted to filter column G from workbook 1 to "Filter 2" and transfer only filter 2 data to workbook 2.
    ' _  Then transferring like i wanted to transfer column C (source) to column B (destination) , column D to D, Column L to Column G, etc.
    ' _  I wanted to sum from column P to colum AA and transfer those sum to destination at column H
    ' _ Then copy from column AB to AH and paste in I to O in destination
    
    Sub Transfer_maras_1()

    Here is a before and after…
    https://excelfox.com/forum/showthrea...ll=1#post15278
    https://excelfox.com/forum/showthrea...ll=1#post15279

    Macro
    https://excelfox.com/forum/showthrea...ll=1#post15277

    Files
    Transfer data_marasAlan_1.xlsm : https://app.box.com/s/p8kf5vo8jesql3n47sd1bzgm57qdpwdv
    Workbook2_1.xlsx : https://app.box.com/s/3d9gmeb2nlyr4gg9q802kk5mjgze8cl5





    _.________________________________________________ _________________________________________________




    Code:
    Sub Transfer_marasAlan_2() '

    Here is a before and after…
    https://excelfox.com/forum/showthrea...ll=1#post15276
    https://excelfox.com/forum/showthrea...ll=1#post15273


    Macro
    https://excelfox.com/forum/showthrea...ll=1#post15272

    Files
    Transfer data_marasAlan_2.xlsm : https://app.box.com/s/749a78z2ku4m1s1tg3fvgs1z1ud4s325
    Workbook2_2.xlsx : https://app.box.com/s/13yh30a77spsluauck3nif309pic8fuz
















    _.___________________________________________

    Code:
    Sub Transfer_marasAlan_3()  '   https://www.excelforum.com/excel-programming-vba-macros/1338596-transferring-data.html#post5460624
    Here is a before and after…
    https://excelfox.com/forum/showthrea...ll=1#post15269
    https://excelfox.com/forum/showthrea...ll=1#post15270

    Macro
    https://excelfox.com/forum/showthrea...ge42#post15271

    Files
    https://excelfox.com/forum/showthrea...ge42#post15233
    Transfer data_marasAlan_3.xlsm : https://app.box.com/s/p8kf5vo8jesql3n47sd1bzgm57qdpwdv
    Workbook2_3.xlsx : https://app.box.com/s/y3rwvhfk3bo1rp9t7cgbk8yz3krymh23

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    Links relavent to the last 9 posts

    Code:
    ' https://www.excelforum.com/excel-programming-vba-macros/1338596-transferring-data.html#post5458446
    ' _  First i wanted to filter column G from workbook 1 to "Filter 2" and transfer only filter 2 data to workbook 2.
    ' _  Then transferring like i wanted to transfer column C (source) to column B (destination) , column D to D, Column L to Column G, etc.
    ' _  I wanted to sum from column P to colum AA and transfer those sum to destination at column H
    ' _ Then copy from column AB to AH and paste in I to O in destination
    
    Sub Transfer_maras_1()

    Here is a before and after…
    https://excelfox.com/forum/showthrea...ll=1#post15278
    https://excelfox.com/forum/showthrea...ll=1#post15279

    Macro
    https://excelfox.com/forum/showthrea...ll=1#post15277

    Files
    Transfer data_marasAlan_1.xlsm : https://app.box.com/s/p8kf5vo8jesql3n47sd1bzgm57qdpwdv
    Workbook2_1.xlsx : https://app.box.com/s/3d9gmeb2nlyr4gg9q802kk5mjgze8cl5





    _.________________________________________________ _________________________________________________




    Code:
    Sub Transfer_marasAlan_2() '

    Here is a before and after…
    https://excelfox.com/forum/showthrea...ll=1#post15276
    https://excelfox.com/forum/showthrea...ll=1#post15273


    Macro
    https://excelfox.com/forum/showthrea...ll=1#post15272

    Files
    Transfer data_marasAlan_2.xlsm : https://app.box.com/s/749a78z2ku4m1s1tg3fvgs1z1ud4s325
    Workbook2_2.xlsx : https://app.box.com/s/13yh30a77spsluauck3nif309pic8fuz
















    _.___________________________________________

    Code:
    Sub Transfer_marasAlan_3()  '   https://www.excelforum.com/excel-programming-vba-macros/1338596-transferring-data.html#post5460624
    Here is a before and after…
    https://excelfox.com/forum/showthrea...ll=1#post15269
    https://excelfox.com/forum/showthrea...ll=1#post15270

    Macro
    https://excelfox.com/forum/showthrea...ge42#post15271

    Files
    https://excelfox.com/forum/showthrea...ge42#post15233
    Transfer data_marasAlan_3.xlsm : https://app.box.com/s/p8kf5vo8jesql3n47sd1bzgm57qdpwdv
    Workbook2_3.xlsx : https://app.box.com/s/y3rwvhfk3bo1rp9t7cgbk8yz3krymh23

  3. #3
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    Links relavent to the last 9 posts

    Code:
    ' https://www.excelforum.com/excel-programming-vba-macros/1338596-transferring-data.html#post5458446
    ' _  First i wanted to filter column G from workbook 1 to "Filter 2" and transfer only filter 2 data to workbook 2.
    ' _  Then transferring like i wanted to transfer column C (source) to column B (destination) , column D to D, Column L to Column G, etc.
    ' _  I wanted to sum from column P to colum AA and transfer those sum to destination at column H
    ' _ Then copy from column AB to AH and paste in I to O in destination
    
    Sub Transfer_maras_1()

    Here is a before and after…
    https://excelfox.com/forum/showthrea...ll=1#post15278
    https://excelfox.com/forum/showthrea...ll=1#post15279

    Macro
    https://excelfox.com/forum/showthrea...ll=1#post15277

    Files
    Transfer data_marasAlan_1.xlsm : https://app.box.com/s/p8kf5vo8jesql3n47sd1bzgm57qdpwdv
    Workbook2_1.xlsx : https://app.box.com/s/3d9gmeb2nlyr4gg9q802kk5mjgze8cl5





    _.________________________________________________ _________________________________________________




    Code:
    Sub Transfer_marasAlan_2() '

    Here is a before and after…
    https://excelfox.com/forum/showthrea...ll=1#post15276
    https://excelfox.com/forum/showthrea...ll=1#post15273


    Macro
    https://excelfox.com/forum/showthrea...ll=1#post15272

    Files
    Transfer data_marasAlan_2.xlsm : https://app.box.com/s/749a78z2ku4m1s1tg3fvgs1z1ud4s325
    Workbook2_2.xlsx : https://app.box.com/s/13yh30a77spsluauck3nif309pic8fuz
















    _.___________________________________________

    Code:
    Sub Transfer_marasAlan_3()  '   https://www.excelforum.com/excel-programming-vba-macros/1338596-transferring-data.html#post5460624
    Here is a before and after…
    https://excelfox.com/forum/showthrea...ll=1#post15269
    https://excelfox.com/forum/showthrea...ll=1#post15270

    Macro
    https://excelfox.com/forum/showthrea...ge42#post15271

    Files
    https://excelfox.com/forum/showthrea...ge42#post15233
    Transfer data_marasAlan_3.xlsm : https://app.box.com/s/p8kf5vo8jesql3n47sd1bzgm57qdpwdv
    Workbook2_3.xlsx : https://app.box.com/s/y3rwvhfk3bo1rp9t7cgbk8yz3krymh23

  4. #4
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    In support of this post
    https://excelfox.com/forum/showthrea...5230#post15230

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    1
    TEST-1
    2
    Name of the Student : Rizwana
    3
    Reg. No. : 256
    4
    Class X
    Worksheet: Test

    If the value of D3 and D4 of Test Sheet is matches with column C & D of Result sheet then, display a message "You are already submitted the test paper and you have secured (D3 and D4 of Test sheet match with column E of Result Sheet) marks".

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    1
    TEST-1 RESULT ANALYSIS
    2
    Sl. No.
    Name of the Student
    Reg. No.
    Class
    Obtained Marks
    3
    01
    Rukhsar banu
    256
    X
    2
    4
    02
    Abdulkhadar
    123
    X
    3
    5
    03
    Rizwana
    256
    X
    4
    6
    04
    Rizwana
    256
    X
    4
    7
    05
    Rizwana
    256
    X
    4
    Worksheet: Result








    15283

  5. #5
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    In support of this post
    https://excelfox.com/forum/showthrea...5230#post15230

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    1
    TEST-1
    2
    Name of the Student : Rizwana
    3
    Reg. No. : 256
    4
    Class X
    Worksheet: Test

    If the value of D3 and D4 of Test Sheet is matches with column C & D of Result sheet then, display a message "You are already submitted the test paper and you have secured (D3 and D4 of Test sheet match with column E of Result Sheet) marks".

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    1
    TEST-1 RESULT ANALYSIS
    2
    Sl. No.
    Name of the Student
    Reg. No.
    Class
    Obtained Marks
    3
    01
    Rukhsar banu
    256
    X
    2
    4
    02
    Abdulkhadar
    123
    X
    3
    5
    03
    Rizwana
    256
    X
    4
    6
    04
    Rizwana
    256
    X
    4
    7
    05
    Rizwana
    256
    X
    4
    Worksheet: Result

  6. #6
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    In support of this post
    https://excelfox.com/forum/showthrea...5230#post15230

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    1
    TEST-1
    2
    Name of the Student : Rizwana
    3
    Reg. No. : 256
    4
    Class X
    Worksheet: Test

    If the value of D3 and D4 of Test Sheet is matches with column C & D of Result sheet then, display a message "You are already submitted the test paper and you have secured (D3 and D4 of Test sheet match with column E of Result Sheet) marks".

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    1
    TEST-1 RESULT ANALYSIS
    2
    Sl. No.
    Name of the Student
    Reg. No.
    Class
    Obtained Marks
    3
    01
    Rukhsar banu
    256
    X
    2
    4
    02
    Abdulkhadar
    123
    X
    3
    5
    03
    Rizwana
    256
    X
    4
    6
    04
    Rizwana
    256
    X
    4
    7
    05
    Rizwana
    256
    X
    4
    Worksheet: Result

  7. #7
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    In support of this post
    https://excelfox.com/forum/showthrea...5230#post15230

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    1
    TEST-1
    2
    Name of the Student : Rizwana
    3
    Reg. No. : 256
    4
    Class X
    Worksheet: Test

    If the value of D3 and D4 of Test Sheet is matches with column C & D of Result sheet then, display a message "You are already submitted the test paper and you have secured (D3 and D4 of Test sheet match with column E of Result Sheet) marks".

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    1
    TEST-1 RESULT ANALYSIS
    2
    Sl. No.
    Name of the Student
    Reg. No.
    Class
    Obtained Marks
    3
    01
    Rukhsar banu
    256
    X
    2
    4
    02
    Abdulkhadar
    123
    X
    3
    5
    03
    Rizwana
    256
    X
    4
    6
    04
    Rizwana
    256
    X
    4
    7
    05
    Rizwana
    256
    X
    4
    Worksheet: Result

  8. #8
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    In support of this post
    https://excelfox.com/forum/showthrea...5230#post15230

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    1
    TEST-1
    2
    Name of the Student : Rizwana
    3
    Reg. No. : 256
    4
    Class X
    Worksheet: Test

    If the value of D3 and D4 of Test Sheet is matches with column C & D of Result sheet then, display a message "You are already submitted the test paper and you have secured (D3 and D4 of Test sheet match with column E of Result Sheet) marks".

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    1
    TEST-1 RESULT ANALYSIS
    2
    Sl. No.
    Name of the Student
    Reg. No.
    Class
    Obtained Marks
    3
    01
    Rukhsar banu
    256
    X
    2
    4
    02
    Abdulkhadar
    123
    X
    3
    5
    03
    Rizwana
    256
    X
    4
    6
    04
    Rizwana
    256
    X
    4
    7
    05
    Rizwana
    256
    X
    4
    Worksheet: Result

  9. #9
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    In support of this post
    https://excelfox.com/forum/showthrea...5230#post15230

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    1
    TEST-1
    2
    Name of the Student : Rizwana
    3
    Reg. No. : 256
    4
    Class X
    Worksheet: Test

    If the value of D3 and D4 of Test Sheet is matches with column C & D of Result sheet then, display a message "You are already submitted the test paper and you have secured (D3 and D4 of Test sheet match with column E of Result Sheet) marks".

    _____ Workbook: Test Paper.xlsb ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    1
    TEST-1 RESULT ANALYSIS
    2
    Sl. No.
    Name of the Student
    Reg. No.
    Class
    Obtained Marks
    3
    01
    Rukhsar banu
    256
    X
    2
    4
    02
    Abdulkhadar
    123
    X
    3
    5
    03
    Rizwana
    256
    X
    4
    6
    04
    Rizwana
    256
    X
    4
    7
    05
    Rizwana
    256
    X
    4
    Worksheet: Result

  10. #10
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    Macro for last post

    Code:
    Option Explicit
    Sub StartOffvbadumbarse()
    Rem 1 Worksheets info
    Dim WsIn As Worksheet, WsOut As Worksheet
     Set WsIn = ThisWorkbook.Worksheets.Item(1): Set WsOut = ThisWorkbook.Worksheets.Item(2)
    Dim arrIn() As Variant: Let arrIn() = WsIn.Range("B1:F5").Value2
    Rem 2
    '2b
    Dim Clm As Long
        For Clm = 1 To 5 Step 1
            If arrIn(1, Clm) = "" Then
            ' Nothing to do for no header
            Else
            Dim Itms As String: Let Itms = arrIn(1, Clm)
            Dim RwDta As Long
                For RwDta = 2 To 5 Step 1
                Dim strFndWd As String
                    If arrIn(RwDta, Clm) = "" Then
                    ' no data
                    Else
                        If InStr(1, arrIn(RwDta, Clm), "|", vbBinaryCompare) > 0 Then ' we must have two or more datas seperatied by a  |
                        Dim CelDts As Long
                            For CelDts = 0 To UBound(Split(arrIn(RwDta, Clm), "|", -1, vbBinaryCompare))
                             Let strFndWd = strFndWd & Split(arrIn(RwDta, Clm), "|", -1, vbBinaryCompare)(CelDts) & vbCr & vbLf
                            Next CelDts
                        Else ' case single data
                         Let strFndWd = strFndWd & arrIn(RwDta, Clm) & vbCr & vbLf  ' effectively a single row is added for this data
                        End If
                    End If
                Next RwDta
            '2e we have been through the data, so time to see what we got and fill our two strings appropriately
            Dim strOutA As String, strOutB As String
                If strFndWd = "" Then ' case we had no data
                 Let strFndWd = strFndWd & vbCr & vbLf ' effectively adds an empty row
                 Let strOutA = strOutA & Itms & vbCr & vbLf ' a single row with header
                Else ' we have data, so need do add some rows to strOutA ( strOutB effecively has all the rows determined by the number of  vbCr & vbLf   added
                Dim RwCnt As Long: Let RwCnt = UBound(Split(strFndWd, vbCr & vbLf, -1, vbBinaryCompare)) + 1 - 1 ' The number of  vbCr & vbLf  gives us the number rows
                    For CelDts = 1 To RwCnt
                     Let strOutA = strOutA & Itms & vbCr & vbLf
                    Next CelDts
                End If
            End If
         Let strOutB = strOutB & strFndWd
         Let strFndWd = ""
        Next Clm
    ' I can view my data in a message box or in the immediate window
     MsgBox Prompt:=strOutA: Debug.Print strOutA
     MsgBox Prompt:=strOutB: Debug.Print strOutB
    
    Rem 3 outout
    Dim arrOutA() As String: Let arrOutA() = Split(strOutA, vbCr & vbLf, -1, vbBinaryCompare) '  Excel has the convention of taking a  1D  array as being "horizontal" for spreadsheet purposes, so will consider it as a row of data values if applied to a worksheet range
    Dim arrOutB() As String: Let arrOutB() = Split(strOutB, vbCr & vbLf, -1, vbBinaryCompare)
    ' Let WsOut.Range("A2").Resize(UBound(arrOutA()), 1).Value = Application.Transpose(arrOutA())
     Let WsOut.Range("A2").Resize(UBound(arrOutA()), 1).Value = Application.Index(arrOutA(), Evaluate("=row(1:" & UBound(arrOutA()) & ")/row(1:" & UBound(arrOutA()) & ")"), Evaluate("=row(1:" & UBound(arrOutA()) & ")"))
    ' Let WsOut.Range("B2").Resize(UBound(arrOutB()), 1).Value = Application.Transpose(arrOutB())
     Let WsOut.Range("B2").Resize(UBound(arrOutB()), 1).Value = Application.Index(arrOutB(), Evaluate("=row(1:" & UBound(arrOutB()) & ")/row(1:" & UBound(arrOutB()) & ")"), Evaluate("=row(1:" & UBound(arrOutB()) & ")"))
    End Sub
    Attached Files Attached Files

Similar Threads

  1. Some Date Notes and Tests
    By DocAElstein in forum Test Area
    Replies: 5
    Last Post: 03-26-2025, 02:56 AM
  2. Replies: 116
    Last Post: 02-23-2025, 12:13 AM
  3. Replies: 21
    Last Post: 12-15-2024, 07:13 PM
  4. Replies: 42
    Last Post: 05-29-2023, 01:19 PM
  5. Replies: 11
    Last Post: 10-13-2013, 10:53 PM

Posting Permissions

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