Page 2 of 11 FirstFirst 1234 ... LastLast
Results 11 to 20 of 102

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

  1. #11
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Sandy Sir can u share the complete code with correction
    bcoz i am confused with this code, i tried to make many changes but i was not successful
    So its my request i am sending u the code plz have a look in it and plz let me know about the correction or correct the code and share the same
    i am using this code
    Code:
    Sub Step14()
    Dim w1 As Workbook, w2 As Workbook, w3 As Workbook
     Set w1 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\1.xls")
     Set w2 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\2.csv")
     Set w3 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\3.xlsx")
    Dim Ws1 As Worksheet, Ws2 As Worksheet, Ws3 As Worksheet
     Set Ws1 = w1.Worksheets.Item(1)
     Set Ws2 = w2.Worksheets.Item(1)
     Set Ws3 = w3.Worksheets.Item(1)
    Dim Lc3 As Long, Lenf1 As Long, Lr1 As Long
     Let Lr1 = Ws1.Range("A" & Ws1.Rows.Count & "").End(xlUp).Row
     Let Lc3 = Ws3.Cells.Item(1, Ws3.Columns.Count).End(xlToLeft).Column
    Dim Lc3Ltr As String
     Let Lc3Ltr = CL(Lc3)
     Let Lenf1 = Lr1 - 1
    Dim rngOut As Range: Set rngOut = Ws2.Range("A1:" & Lc3Ltr & Lenf1 & "")
     Ws2.Cells.NumberFormat = "General"
     Let rngOut.Value = "='[3.xlsx]" & Ws3.Name & "'!A$1"
     Let rngOut.Value = rngOut.Value
     Let rngOut.Value = Evaluate("If({1},SUBSTITUTE(" & rngOut.Address & ", ""0"", """"))")
    Dim rngIn As Range
     Set rngIn = Ws3.Range("A1:" & Lc3Ltr & "1")
     rngIn.Copy
     rngOut.PasteSpecial Paste:=xlPasteValues
     w1.Close
     w2.Save
     Let Application.DisplayAlerts = False
     w2.Close
     Let Application.DisplayAlerts = True
     w3.Close
    
    End Sub
    .
    Last edited by DocAElstein; 05-05-2020 at 10:53 AM.

  2. #12
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    233
    Rep Power
    6
    sorry but no. I am away from vba.
    I checked csv only, that's all
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  3. #13
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Code:
     Ws2.Cells.NumberFormat = "General"
    I changed this to
    Code:
     Ws2.Cells.NumberFormat = Chr(9)
    But i am not getting correct output sandy Sir

  4. #14
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    233
    Rep Power
    6
    chr(160) or chr(9) are delimiters not a format
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  5. #15
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Sorry for the same
    Plz let me know sandy sir what correction i want to do

  6. #16
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    233
    Rep Power
    6
    My dear friend, as I said I am not able to help you with vba
    You need to describe your problem with details, what you want to do, post representative example (excel file and source(s) )what you have and what is your expected result
    then maybe any master of vba will help you
    Last edited by sandy666; 05-04-2020 at 11:54 PM. Reason: typo
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  7. #17
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Problem is already described in the post sandy sir plz relook

  8. #18
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    233
    Rep Power
    6
    result.csv.txt
    is that what you want?

    note: remove .txt to get result.csv only
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

  9. #19
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Bro i am not getting what u mean to say i tried to correct it from many ways but i was unsuccessful
    if there is any changes or correction plz correct it and share
    i am not having enough knowledge of vba tp solve this problem

  10. #20
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    233
    Rep Power
    6
    I am not talking about vba but asking question: the file i posted above is in format you want to achieve?
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

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
  •