Results 1 to 10 of 102

Thread: VBA Copy Rows From One Workbook To text csv File Based On Count In Different Workbook. Cross Posted Chaos

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10
    Remember to always please give a link to everywhere else that you post, for example
    http://www.eileenslounge.com/viewtopic.php?f=30&t=34508 http://www.eileenslounge.com/viewtopic.php?f=30&t=34508

    If you have posted anywhere else then please tell us where





    In the macro I have done for you , there are two possibilities.
    You only need one
    You can choose
    ' 2b)(i) Relative formula references ...
    Code:
    ' 2b)(i)  Relative formula references  ... https://teylyn.com/2017/03/21/dollarsigns/#comment-191
     Ws2.Cells.NumberFormat = "General"                          ' May be needed to prevent formulas coming out as test     =[3.xlsx]Sheet1!$A$1
     Let rngOut.Value = "='[3.xlsx]" & Ws3.Name & "'!A$1"
     Let rngOut.Value = rngOut.Value  '  Change Formulas to values
     Let rngOut.Value = Evaluate("If({1},SUBSTITUTE(" & rngOut.Address & ", ""0"", """"))")      '                              https://excelribbon.tips.net/T010741_Removing_Spaces
    ' Or
    '' 2b)(ii) Copy paste
    'Dim rngIn As Range
    ' Set rngIn = Ws3.Range("A1:" & Lc3Ltr & "1")
    ' rngIn.Copy
    ' rngOut.PasteSpecial Paste:=xlPasteValues  '   understanding  Paste  across ranges of different size to  Copy  range : https://excelfox.com/forum/showthread.php/2221-VBA-Range-Insert-Method-Code-line-makes-a-space-to-put-new-range-in?p=10441&viewfull=1#post10441
    OR
    ' 2b)(ii) Copy Paste

    Code:
    ' 2b)(i)  Relative formula referrences  ... https://teylyn.com/2017/03/21/dollarsigns/#comment-191
    ' Ws2.Cells.NumberFormat = "General"                          ' May be needed to prevent formulas coming out as test     =[3.xlsx]Sheet1!$A$1
    ' Let rngOut.Value = "='[3.xlsx]" & Ws3.Name & "'!A$1"
    ' Let rngOut.Value = rngOut.Value  '  Change Formulas to values
    ' Let rngOut.Value = Evaluate("If({1},SUBSTITUTE(" & rngOut.Address & ", ""0"", """"))")      '                              https://excelribbon.tips.net/T010741_Removing_Spaces
    ' Or
    ' 2b)(ii) Copy Paste
    Dim rngIn As Range
     Set rngIn = Ws3.Range("A1:" & Lc3Ltr & "1")
     rngIn.Copy
     rngOut.PasteSpecial Paste:=xlPasteValues  '   understanding  Paste  across ranges of different size to  Copy  range : https://excelfox.com/forum/showthread.php/2221-VBA-Range-Insert-Method-Code-line-makes-a-space-to-put-new-range-in?p=10441&viewfull=1#post10441
    Before:
    _____ Workbook: 3.xlsx ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    1
    NSE
    6
    A GTT
    2
    Worksheet: Sheet1

    _____ Workbook: 1.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    1
    Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    2
    NSE ACC EQ
    1182
    1193
    1151.7
    1190.45
    1156.6
    22
    11.566
    116815
    1168.166
    3
    NSE ADANIENT EQ
    137.15
    140.55
    134.1
    140.5
    134.65
    25
    1.3465
    13595
    135.9965
    4
    NSE ADANIPORTS EQ
    273.95
    276.95
    269.55
    277.6
    270.65
    15083
    2.7065
    27335
    273.3565
    5
    NSE ADANIPOWER EQ
    32.3
    32.35
    30.45
    32.45
    30.65
    17388
    0.3065
    3095
    30.9565
    6
    NSE AMARRAJA EQ
    555
    555
    529.25
    557.85
    532.1
    100
    5.321
    5374
    537.21
    7
    Worksheet: 1-Sheet1 3Mai

    _____ Workbook: 2.csv ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    2
    3
    Worksheet: 2


    After running macro here : https://excelfox.com/forum/showthrea...ll=1#post13184

    _____ Workbook: 2.csv ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    1
    NSE
    6
    A GTT
    2
    NSE
    6
    A GTT
    3
    NSE
    6
    A GTT
    4
    NSE
    6
    A GTT
    5
    NSE
    6
    A GTT
    6
    Worksheet: 2



    Alan



    Share ‘1.xls’ : https://app.box.com/s/38aoip5xi7018y9syt0xe4g04u95l6xk
    Share ‘macro.xlsm’ : https://app.box.com/s/599q2it3uck3hfwm5kscmmgtn0be66wt
    Share ‘2.csv’ : https://app.box.com/s/sop0hl5slstjv38tr8wtvp7f7l39ep3k
    Share ‘3.xlsx’ : https://app.box.com/s/8k9b556duom523b381m80oeixonp0042





    Edit ... cross posted later once again!!!!
    https://chandoo.org/forum/threads/copy-and-paste.44182/
    https://excelfox.com/forum/showthrea...ll=1#post13439
    Last edited by DocAElstein; 05-27-2020 at 04:45 PM.

Similar Threads

  1. Replies: 4
    Last Post: 04-10-2014, 10:58 PM
  2. Replies: 2
    Last Post: 09-18-2013, 12:30 AM
  3. TO convert Excel entire workbook in csv format
    By pritee in forum Excel Help
    Replies: 11
    Last Post: 08-16-2013, 11:28 AM
  4. Replies: 4
    Last Post: 06-20-2013, 04:25 PM
  5. Replies: 9
    Last Post: 09-09-2011, 02:30 AM

Tags for this Thread

Posting Permissions

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