Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #109511

Re: Huge data set Find-Replace

Newsgroups microsoft.public.excel.programming
Date 2016-11-01 18:01 -0700
References (1 earlier) <nv956p$297$1@dont-email.me> <nv95ip$342$1@dont-email.me> <48812e8f-ca61-4673-af94-b488eb15c40c@googlegroups.com> <nvaprp$be3$1@dont-email.me> <nvb7gn$1gs$1@dont-email.me>
Message-ID <50406397-ecd8-4ad7-8917-57862adbb577@googlegroups.com> (permalink)
Subject Re: Huge data set Find-Replace
From "L. Howard" <lhkittle@comcast.net>

Show all headers | View raw


Hi Garry,

I found these in the search area you suggested.

I have no idea how to make them work, nor can I see them when I call up the Macro box with f8 from the sheet with my test data.

Howard

Sub WksToTabFile(Optional Wks As Worksheet)
' Loads worksheet data into a tab-delimited text file
' Requires WriteTextFile() to create the file

  Dim vData, n&, sFile$

  sFile = Application.GetSaveAsFilename
  If sFile = False Then Exit Sub

  If Wks Is Nothing Then Set Wks = ActiveSheet
  vData = Wks.UsedRange
  ReDim vTmp(1 To UBound(vData))

  'Load data from 2D array to 1D array
  For n = LBound(vData) To UBound(vData)
    vTmp(n) = Join(Application.Index(vData, n, 0), vbTab)
  Next 'n

  'Write data to text file
  WriteTextFile Join(vTmp, vbCrLf), sFile
End Sub

Sub WriteTextFile(TextOut$, Filename$, _
                  Optional AppendMode As Boolean = False)
' Reusable procedure that Writes/Overwrites or Appends
' large amounts of data to a Text file in one single step.
' **Does not create a blank line at the end of the file**
  Dim iNum%
  On Error GoTo ErrHandler
  iNum = FreeFile()
  If AppendMode Then
    Open Filename For Append As #iNum: Print #iNum, vbCrLf & TextOut;
  Else
    Open Filename For Output As #iNum: Print #iNum, TextOut;
  End If

ErrHandler:
  Close #iNum: If Err Then Err.Raise Err.Number, , Err.Description
End Sub 'WriteTextFile()

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Huge data set Find-Replace "L. Howard" <lhkittle@comcast.net> - 2016-10-31 19:17 -0700
  Re: Huge data set Find-Replace GS <gs@v.invalid> - 2016-11-01 00:21 -0400
    Re: Huge data set Find-Replace GS <gs@v.invalid> - 2016-11-01 00:27 -0400
      Re: Huge data set Find-Replace "L. Howard" <lhkittle@comcast.net> - 2016-11-01 01:11 -0700
        Re: Huge data set Find-Replace GS <gs@v.invalid> - 2016-11-01 15:19 -0400
          Re: Huge data set Find-Replace GS <gs@v.invalid> - 2016-11-01 19:12 -0400
            Re: Huge data set Find-Replace "L. Howard" <lhkittle@comcast.net> - 2016-11-01 18:01 -0700
              Re: Huge data set Find-Replace GS <gs@v.invalid> - 2016-11-02 00:47 -0400

csiph-web