Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8019593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:25:59+00:00 2026-06-04T21:25:59+00:00

I searched for an answer to this question, but it seems like the only

  • 0

I searched for an answer to this question, but it seems like the only ways that people have answered it are using Excel functions. I have a file in Excel that I load in to a text file, but new data comes out every week. I need to replace the Market names in this first column with their respective tickers, which are in this separate worksheet, but in the same Excel file.

For example, I want all ‘CANADIAN DOLLAR – CHICAGO MERCANTILE EXCHANGE’ cells to be replaced with ‘CAD’, all ‘SWISS FRANC – CHICAGO MERCANTILE EXCHANGE’ cells to be replaced with ‘SWF’, etc.

I would prefer if the names remained the same in the Excel file and were only changed when I transferred them to the text file. However, that’s not essential if it’s harder to do.

For reference, here’s the code I’m using to write to the text file:

Sub getData1()
On Error GoTo ErrHandler:
''Finding Row Information
Dim Ticker As String
Dim rCount As Integer, i As Integer, j As Integer, rcCount As Integer, rowStr As String
rCount = Application.CountA([RDRows])
rcCount = Application.CountA([RDCols])
Myfile = "H:\wkoorbusch\Desktop\" & "CFTC_Fin_Data.txt"

Dim fnum As Integer
fnum = FreeFile
Open Myfile For Output As fnum
For i = 1 To rCount
    For j = 1 To rcCount
        rowStr = [Start].Offset(i, 0).Value & "," & [Start].Offset(0, j).Value _
        & "," & Format([Start].Offset(i, 2).Value, _
        "mm/dd/yyyy") & "," & [Start].Offset(i, j).Value
        Print #fnum, rowStr
    Next j
Next i
Close fnum
Exit Sub

ErrHandler:
    Close fnum
End Sub

Thanks in advance for any and all help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:26:01+00:00Added an answer on June 4, 2026 at 9:26 pm

    Place the Text and its replacement in 2 colums of your spreadsheet, then use

    On Error Resume Next
    Application.WorksheetFunction.VLookup(MyText,range("Sheet1!A1:B300"),2,False)
    If Err.Number=1004 then msgbox "Value " & MyText & " not found"
    

    to return the replacement text.
    A trappable err.Number of 1004 is returned when the lookup value is not found.

    (functionally equivalent to VLOOKUP as a spreadsheet formula)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I searched and found this question but did not like the answer. Is there
Okay, so first, I have searched for this everywhere but it seems like every
I've searched for the answer to this question but I can't seem to find
Searched a lot about this problem but never found a answer, that solved it.
I have searched for an answer but couldn't find it anywhere. My question is
This seems like a simple question, but I haven't been able to find the
Hello I searched for an answer to this question but didn't find any here.
This seems like a trivial problem, but my web searches for an answer (even
I have searched far and wide for an answer to this question and would
I've searched and this seems to be a simple question without a simple answer.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.