Page 30 of 30 FirstFirst ... 20282930
Results 291 to 294 of 294

Thread: Appendix Thread. ( Codes for other Threads, ( Avinash ).)

  1. #291
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    Some notes in support of these Threads and posts
    This thread , that thread

    Hans penultimate

    Code:
    '      https://eileenslounge.com/viewtopic.php?p=272599#p272599       https://eileenslounge.com/viewtopic.php?p=272605#p272605
    Sub STEP2() ' Hans penultimate
    Dim w1 As Workbook
    Set w1 = ActiveWorkbook                    ' CHANGE TO SUIT
    Dim ws1 As Worksheet
    'Set ws1 = w1.Worksheets.Item(2)
    Set ws1 = w1.Worksheets("HansPenultimate") ' CHANGE TO SUIT
    Dim MyData As String
    Dim lineData() As String, strData() As String, myFile As String
    Dim i As Long, rng As Range
    
    'On Error Resume Next
    
    'myFile = "C:\Users\WolfieeeStyle\Desktop\NSEVAR.txt"
    myFile = ThisWorkbook.Path & "\NSEVAR.txt" ' CHANGE TO SUIT
    Open myFile For Binary As #1
    MyData = Space$(LOF(1))
    Get #1, , MyData
    Close #1
    
    lineData() = Split(MyData, vbNewLine)
    Set rng = ws1.Range("A2")
    
    For i = 0 To UBound(lineData)
        
        strData = Split(lineData(i), ",")
           
        rng.Offset(i, 0).Resize(1, UBound(strData) + 1) = strData
        
    Next
    '    ws1.Range("A:A").Select
    '
    '
    '     Selection.TextToColumns Destination:=ws1.Range("A1"), DataType:=xlDelimited, _
    '        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
    '        Semicolon:=False, Comma:=True, Space:=False, Other:=False, OtherChar _
    '        :=",", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
    '        1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1)), _
    '        TrailingMinusNumbers:=True
        
    ws1.Columns("A:Z").AutoFit
    
    
    ws1.Range("A1").Select
    
    w1.Save
    
    End Sub
    
    My modifed from last macro
    Code:
    Sub TextFileToExcel_GroundhogDay12()  '  http://www.eileenslounge.com/viewtopic.php?f=30&t=35100          http://www.eileenslounge.com/viewtopic.php?p=268809#p268809
    Rem 1 Workbooks,  Worksheets info
    Dim Wb As Workbook, Ws As Worksheet
     Set Wb = Workbooks("macro.xlsb")      ' CHANGE TO SUIT
    ' Set Ws = Wb.Worksheets.Item(2)      ' second worksheet
     Set Ws = Wb.Worksheets("Mylastmacro") ' CHANGE TO SUIT
    Dim lr As Long: Let lr = Ws.Range("A" & Ws.Rows.Count & "").End(xlUp).Row       '   http://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=11466&viewfull=1#post11466      Making Lr dynamic ( using rng.End(XlUp) for a single column. )
    Dim NxtRw As Long
        If lr = 1 And Ws.Range("A1").Value = "" Then
         Let NxtRw = 1      '  If there is no data in the worksheet we want the first row to be the start row
        Else
         Let NxtRw = lr + 1 '  If there is data in the worksheet, we want the data to be posted after the last used row
        End If
    Rem 2 Text file info
    ' 2a) get the text file as a long single string
    Dim FileNum As Long: Let FileNum = FreeFile(1)                                  ' https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/freefile-function
    Dim PathAndFileName As String, TotalFile As String
     Let PathAndFileName = ThisWorkbook.Path & "\" & "NSEVAR.txt"   ' CHANGE TO SUIT    From vixer zyxw1234  : http://www.eileenslounge.com/viewtopic.php?f=30&t=34629     DF.txt https://app.box.com/s/gw941dh9v8sqhvzin3lo9rfc67fjsbic
    Open PathAndFileName For Binary As #FileNum 'Open Route to data. Binary is a fundemental type data input...
    TotalFile = Space(LOF(FileNum)) '....and wot recives it has to be a string of exactly the right length
    Get #FileNum, , TotalFile
    Close #FileNum
    ' 2b) Split into wholes line _ splitting the text file into rows by splitting by vbCr & vbLf ( Note vbCr & vbLf = vbNewLine )
    Dim arrRws() As String: Let arrRws() = Split(TotalFile, vbCr & vbLf, -1, vbBinaryCompare)
    Dim RwCnt As Long: Let RwCnt = UBound(arrRws()) + 1    '  +1 is nedeed as the  Split Function  returns indicies 0 1 2 3 4 5   etc...
    ' we can now make an array for all the rows, and we know our columns are A-J = 10 columns
    Dim arrOut() As String: ReDim arrOut(1 To RwCnt, 1 To 10)
    
    Rem 3 An array is built up by _....
    Dim Cnt As Long
        For Cnt = 1 To RwCnt '               _.. considering each row of data
        Dim arrClms() As String
         Let arrClms() = Split(arrRws(Cnt - 1), ",", -1, vbBinaryCompare)  '  ___.. splitting each row into columns by splitting by the comma
        Dim Clm As Long   '
            For Clm = 1 To UBound(arrClms()) + 1
             Let arrOut(Cnt, Clm) = arrClms(Clm - 1)
            Next Clm
        Next Cnt
    
    Rem 4  Finally the array is pasted to the worksheet at the next free row
    ' Let Ws.Range("A" & NxtRw & "").Resize(RwCnt, 10).Value2 = arrOut()
     Let Ws.Range("A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "").Value2 = arrOut()
    ' Ws.Columns("A:J").AutoFit
    Rem 5 to remove  http://www.eileenslounge.com/viewtopic.php?p=272606&sid=7e8ad1b708dd49a811498ccac6b1e092#p272606    .....     when i click on any cell that has output   there is an option numbers stored as text, convert to numbers,help on this error,ignore error,edit in formula bar,error checking options(these are the options coming)
    ' Let Ws.Range("A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "").Value2 = Evaluate("=IF(A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "="""","""",IF(ISERROR(1*A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "),A" & NxtRw & ":J" & RwCnt & ",1*A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "))")
    ' Let Ws.Range("B" & NxtRw & ":D" & RwCnt + (NxtRw - 1) & "").Value2 = Evaluate("=IF(B" & NxtRw & ":D" & RwCnt + (NxtRw - 1) & "="""","""",IF(ISERROR(1*B" & NxtRw & ":D" & RwCnt + (NxtRw - 1) & "),B" & NxtRw & ":D" & RwCnt & ",1*B" & NxtRw & ":D" & RwCnt + (NxtRw - 1) & "))")
    ' Let Ws.Range("A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "").Value2 = Evaluate("=IF(A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "="""","""",IF(ISNUMBER(1*A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "),1*A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & ",A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "))")
    
    End Sub

    Hans final macro in this thread

    Code:
    Sub STEP2_() ' to remove  http://www.eileenslounge.com/viewtopic.php?p=272606&sid=7e8ad1b708dd49a811498ccac6b1e092#p272606    .....     when i click on any cell that has output   there is an option numbers stored as text, convert to numbers,help on this error,ignore error,edit in formula bar,error checking options(these are the options coming)
        Dim w1 As Workbook
        Dim ws1 As Worksheet
        Dim MyData As String
        Dim lineData() As String, strData() As String, myFile As String
        Dim i As Long, rng As Range
    
        'myFile = "C:\Users\WolfieeeStyle\Desktop\NSEVAR.txt"
        myFile = ThisWorkbook.Path & "\NSEVAR.txt"
    
        Open myFile For Binary As #1
        MyData = Space$(LOF(1))
        Get #1, , MyData
        Close #1
    
        lineData() = Split(MyData, vbNewLine)
        Set w1 = ActiveWorkbook
        Set ws1 = w1.Worksheets.Item(2)
        With ws1.Range("A2").Resize(UBound(lineData) + 1)
            .Value = Application.Transpose(lineData)
            .TextToColumns Destination:=ws1.Range("A2"), DataType:=xlDelimited, _
                TextQualifier:=xlDoubleQuote, Comma:=True, _
                FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), _
                Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1))
        End With
    End Sub
    
    Last edited by DocAElstein; 08-06-2020 at 02:49 PM.
    A Folk, A Forum, A Fuhrer ….

  2. #292
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    Post for later use, ( to get URL already now ) - .

    testing




    Moderator” Notice

    **I am Banning you to prevent you making any more postings here of the type you have been making here and elsewhere under hundreds of different user names at many of the English speaking Excel and Office help forums for the last couple of years.

    The type of post that you have been posting suggest that
    _ You may be one person or a team of many people working at something organised like a Call Centre.
    _ You have almost no understanding of the English language
    _ You may not have a computer and may have no access to Excel
    _ You have no interest in Excel or Excel VBA
    _ You have almost no knowledge or interest in any of the questions that you are asking
    _ You may be simply offering a service of posting other peoples questions and supplying them with any answers you get.
    _ You may be part of the development of a question asking and Replying Bot


    _ In some cases, something extremely simple to understand, has been explained to you in great detail , even graphically, such that even a small mentally handicapped child could understand it and remember it. Despite this, you continually ask exactly the same question over and over again: If you are part of a team interested in only posting questions and taking the answer, then you are very badly organised,
    Or
    There is no real intelligence behind what is producing your questions and posts
    _ One of the things you consistently do after receiving a macro is to delete all explanations, explaining 'comments and all files associated, and indeed it appears as if you try to remove almost all record of the coding and the question and answer. This further encourages the posting of the same or similar questions over and over again.

    Whatever you are attempting to do, it appears to be extremely, almost insanely, inefficient ,
    compared to
    a single person with a computer and Excel, and a minimum of basic Excel VBA knowledge trying to achieve the same.

    The main reason for the ban is
    Whatever you are attempting to do, it is requiring 10-100 times more time than is typically required of helpers at a forum. All indications are that what you are doing will fail to achieve anything, and is therefore a total waste of everyone’s time. At excelfox, the current small number of helpers have only a limited amount of time, but even if we had more members, excelfox would not be the place for you##

    These are some suggestions, from me, on how you should continue
    _ If you intend to continue, regardless of any of my previous suggestions, in postings of the type as you have done in the past, then you should think about making some changes to your wording, introduce some new canned replies, possibly organise a new set of similar questions and post at the major forums, such as mrexcel.com, excelforum.com, ozgrid.com
    _ If you wish to make a career out of posting questions and getting answers with out having any real intentions of thinking about anything, then excelfox is not the forum for you to post in. Most of the smaller forums are not the place for you. The larger forums may be able to accommodate you, if you give at least some thought to making it not quite so obvious as you have been doing. Many people do the such. At least half the traffic at such forums originates from such. I have passed many people on to such forums and they are making a successful career based on passing on the work done for them by helpers at the major forums. Such is actually encouraged, all be it , not openly.
    _ If you have not understood most of this Moderator Notice , then your first priority should be to improve on your English. Indeed, your apparent understanding and ability in communicating in English suggests that you will achieve nothing whatsoever and fail completely in anything at all involving communicating in English.

    _ If you are, as you sometimes told me, actively working on an important personal problem requiring VBA , then you are doing it totally wrongly: You have been on the project already for at least two years and have a mixed up set of codings produced by many different people. Some work . Some don’t. You have not the slightest idea or understanding of any of the codings. You will never be able to use them to any effect. If , on the other hand, you had a computer, with Excel, and spent a few weeks learning VBA, and then carefully studied all the macros that you have been given, then you would be able to answer most of your further questions, and would have at least a chance of being able to use the codings effectively.



    ##The main purpose of the question section of excelfox is approximately the following:
    _1. Promote and improve the understanding of Excel and Excel VBA.
    _2. Help people who get stuck on a problem and/or help people who are unsure how to proceed in solving a problem using Excel and Excel VBA.

    Your objectives??
    I do not know what the true reason is behind your postings. I can’t believe anything you say is your purpose, since you have lied and contradicted yourself in the past. The only thing we know 100% for sure is that your posting types are not for any of the purposes for which the question section of excelfox is intended.
    You have had the benefit of the doubt given to you now very many times. You have had lots of chances.
    You may be able to continue at some of the major forums, where some people are happy to continue to spend time to answer similar questions from the same source.
    I do not think you get any more replies to the types of postings you have been making at excelfox or at any other of the smaller English speaking Forums. You are wasting your time making any such posts from now on.
    **I am Banning you, not as any form of punishment, but purely as in the past , it has proven to be the only way to prevent you wasting yours and other peoples time with your postings.
    I do wish you luck and success with what ever it is you are attempting to do. But you should not be doing it at excelfox.
    Last edited by DocAElstein; 09-13-2020 at 02:42 PM.
    A Folk, A Forum, A Fuhrer ….

  3. #293
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    Macro in support of this Thread and posts.
    This thread ,
    that thread
    http://www.eileenslounge.com/viewtop...272682#p272682
    https://eileenslounge.com/viewtopic....272706#p272706
    ( and probably a dozen more in the next few months.... )

    Code:
    Sub TextFileToExcel_GroundhogDay12b()  '  http://www.eileenslounge.com/viewtopic.php?f=30&t=35100          http://www.eileenslounge.com/viewtopic.php?p=268809#p268809
    Rem 1 Workbooks,  Worksheets info
    Dim Wb As Workbook, Ws As Worksheet
     Set Wb = Workbooks("macro.xlsb")      ' CHANGE TO SUIT
     Set Ws = Wb.Worksheets.Item(2)      ' second worksheet
    ' Set Ws = Wb.Worksheets("Mylastmacro") ' CHANGE TO SUIT
    Dim lr As Long: Let lr = Ws.Range("A" & Ws.Rows.Count & "").End(xlUp).Row       '   http://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=11466&viewfull=1#post11466      Making Lr dynamic ( using rng.End(XlUp) for a single column. )
    Dim NxtRw As Long
        If lr = 1 And Ws.Range("A1").Value = "" Then
         Let NxtRw = 2      '  If there is no data in the worksheet we want the second row to be the start row
        Else
         Let NxtRw = lr + 1 '  If there is data in the worksheet, we want the data to be posted after the last used row
        End If
    Rem 2 Text file info
    ' 2a) get the text file as a long single string
    Dim FileNum As Long: Let FileNum = FreeFile(1)                                  ' https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/freefile-function
    Dim PathAndFileName As String, TotalFile As String
     Let PathAndFileName = ThisWorkbook.Path & "\" & "NSEVAR.txt"   ' CHANGE TO SUIT    From vixer zyxw1234  : http://www.eileenslounge.com/viewtopic.php?f=30&t=34629     DF.txt https://app.box.com/s/gw941dh9v8sqhvzin3lo9rfc67fjsbic  NSEVER.txt: https://app.box.com/s/245h7i5nh6an8vw08g8t08fvu30ylih2
    Open PathAndFileName For Binary As #FileNum 'Open Route to data. Binary is a fundemental type data input...
    TotalFile = Space(LOF(FileNum)) '....and wot recives it has to be a string of exactly the right length
    Get #FileNum, , TotalFile
    Close #FileNum
    ' 2b) Split into wholes line _ splitting the text file into rows by splitting by vbCr & vbLf ( Note vbCr & vbLf = vbNewLine )
    Dim arrRws() As String: Let arrRws() = Split(TotalFile, vbCr & vbLf, -1, vbBinaryCompare)
    Dim RwCnt As Long: Let RwCnt = UBound(arrRws()) + 1    '  +1 is nedeed as the  Split Function  returns indicies 0 1 2 3 4 5   etc...
    ' we can now make an array for all the rows, and we know our columns are A-J = 10 columns
    Dim arrOut() As String: ReDim arrOut(1 To RwCnt, 1 To 10)
    
    Rem 3 An array is built up by _....
    Dim Cnt As Long
        For Cnt = 1 To RwCnt '               _.. considering each row of data
        Dim arrClms() As String
         Let arrClms() = Split(arrRws(Cnt - 1), ",", -1, vbBinaryCompare)  '  ___.. splitting each row into columns by splitting by the comma
        Dim Clm As Long   '
            For Clm = 1 To UBound(arrClms()) + 1
             Let arrOut(Cnt, Clm) = arrClms(Clm - 1)
            Next Clm
        Next Cnt
    
    Rem 4  Finally the array is pasted to the worksheet at the next free row
    ' Let Ws.Range("A" & NxtRw & "").Resize(RwCnt, 10).Value2 = arrOut()
     Let Ws.Range("A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "").Value2 = arrOut()
    ' Ws.Columns("A:J").AutoFit
    Rem 5 to remove  http://www.eileenslounge.com/viewtopic.php?p=272606&sid=7e8ad1b708dd49a811498ccac6b1e092#p272606    .....     when i click on any cell that has output   there is an option numbers stored as text, convert to numbers,help on this error,ignore error,edit in formula bar,error checking options(these are the options coming)
     Let Ws.Range("A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "").Value2 = Evaluate("=IF(A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "="""","""",IF(ISNUMBER(1*A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "),1*A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & ",A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "))")
    ' Let Ws.Range("A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "").Value2 = Evaluate("=IF(A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "="""","""",IF(ISERROR(1*A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "),A" & NxtRw & ":J" & RwCnt & ",1*A" & NxtRw & ":J" & RwCnt + (NxtRw - 1) & "))")
    ' Let Ws.Range("B" & NxtRw & ":D" & RwCnt + (NxtRw - 1) & "").Value2 = Evaluate("=IF(B" & NxtRw & ":D" & RwCnt + (NxtRw - 1) & "="""","""",IF(ISERROR(1*B" & NxtRw & ":D" & RwCnt + (NxtRw - 1) & "),B" & NxtRw & ":D" & RwCnt & ",1*B" & NxtRw & ":D" & RwCnt + (NxtRw - 1) & "))")
    
    End Sub
    _.___________________________


    Macro.xlsb : https://app.box.com/s/uwpnuqmnc1uxpl0wpfrbh52iqr1enfcv
    NSEVER.txt : https://app.box.com/s/245h7i5nh6an8vw08g8t08fvu30ylih2
    Last edited by DocAElstein; 08-06-2020 at 04:09 PM.
    A Folk, A Forum, A Fuhrer ….

  4. #294
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    In support of this Thread, ( more out of my interests, its totally lost on the OP …. https://excelfox.com/forum/showthrea...lsx-to-notepad

    As done many times before….
    In Notepad
    https://imgur.com/eOUaOZv


    Reducing the size , for convenience …
    https://imgur.com/FvCn18d


    Using a macro we have used many times…
    Code:
    Sub Sept22()  '   https://excelfox.com/forum/showthread.php/2640-Macro-Correction-converting-data-from-xlsx-to-notepad     https://excelfox.com/forum/showthread.php/2577-Appendix-Thread-(-Codes-for-other-Threads-(-Avinash-)-)?p=14970&viewfull=1#post14970
    Dim FileNum As Long: Let FileNum = FreeFile(1) ' https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/freefile-function
    Dim PathAndFileName As String, TotalFile As String
     Let PathAndFileName = ThisWorkbook.path & "\" & "AlertExFoxReduced.txt" '
    Open PathAndFileName For Binary As #FileNum 'Open Route to data. Binary is a fundemental type data input...
    TotalFile = Space(LOF(FileNum)) '....and wot recives it hs to be a string of exactly the right length
    Get #FileNum, , TotalFile
    Close #FileNum
    ' What the fuck is in this string?
    Call WtchaGot_Unic_NotMuchIfYaChoppedItOff(TotalFile)
    
    End Sub
    The macro above gives us:
    Code:
     "NSE" & "," & "15083" & "," & "6" & "," & Chr(62) & "=" & "," & "34300" & "," & "A" & "," & "," & "," & "," & "," & "GTT" & "," & vbLf & "NSE" & "," & "404" & "," & "6" & "," & Chr(62) & "=" & "," & "56700" & "," & "A" & "," & "," & "," & "," & "," & "GTT" & "," & vbLf & "NSE" & "," & "2181" & "," & "6" & "," & Chr(62) & "=" & "," & "1283170" & "," & "A" & "," & "," & "," & "," & "," & "GTT" & "," & vbLf
    So we have what looks like a vbLf for the line separator












    Share ‘Alert.ExForum.txt’ : https://app.box.com/s/4gn2nlnmnwda8kalp9yugn2j4qvh0891
    Share ‘Alert. (1)ExFox.txt’ : https://app.box.com/s/btcb75mogjarlu1o55aq9ncj8x9mx91i
    Attached Files Attached Files
    Last edited by DocAElstein; 09-24-2020 at 02:52 AM.
    A Folk, A Forum, A Fuhrer ….

Similar Threads

  1. Replies: 185
    Last Post: 05-22-2024, 10:02 PM
  2. Tests and Notes for EMail Threads
    By DocAElstein in forum Test Area
    Replies: 29
    Last Post: 11-15-2022, 04:39 PM
  3. Replies: 379
    Last Post: 11-13-2020, 07:44 PM
  4. Appendix Thread. Diet Protokol Coding Adaptions
    By DocAElstein in forum Test Area
    Replies: 6
    Last Post: 09-05-2019, 10:45 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
  •