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 8893261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:12:04+00:00 2026-06-14T23:12:04+00:00

I have an excel sheet with templated data. I want to be able to

  • 0

I have an excel sheet with templated data. I want to be able to replace occurrences of words in A1:A5 with what I type into B1:B5 for the rest of the document.

Right now I’m going off of this (and I don’t know much VBA):

Sub UpdatePartial()
With ActiveSheet.UsedRange
.Replace "ZIPCODE", "B1", xlPart
.Replace "NAME", "B2", xlPart
.Replace "CITY", "B3", xlPart
.Replace "STATE", "B4", xlPart
.Replace "PHONE", "B5", xlPart
End With
End Sub

but I would like to replace the As with the contents of B1-B5 instead of the literal text “B1″,”B2”, …, “B5”, etc

  • 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-14T23:12:05+00:00Added an answer on June 14, 2026 at 11:12 pm

    Rather than

    .Replace "ZIPCODE", "B1", xlPart
    use
    .Replace [a1].Value, [b1].Value, xlPart

    If you want to replace whole words only within a cell
    (ie if you wanted to replace cat with dog but avoid changing catscan to dogscan then build in a space check before or after the string)

    use
    .Replace " " & [a1].Value, " " & [b1].Value, xlPart
    .Replace [a1].Value & " ", [b1].Value & " ", xlPart

    Your updated question

    Sub UpdatePartial()
        Dim rng1 As Range
        ActiveSheet.UsedRange
        Set rng1 = Intersect(ActiveSheet.UsedRange, Range(Cells(6, "a"), Cells(ActiveSheet.UsedRange.Rows.Count, ActiveSheet.UsedRange.Columns.Count)))
        With rng1
            .Replace [a1].Value, [b1].Value, xlPart
        End With
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an excel sheet that I want to load into a datatable withe
I have a dynamic range in an Excel sheet. DATA_TABLE =OFFSET(DATA!$B$3,0,0,COUNTA(DATA!$B:$B)-1,0) I want to
I have excel sheet with data which I want to get Levenshtein Distance between
I have a excel sheet with 7 fields. I want to remove/filter all the
I have one excel sheet where user will enter meta data in each cell.
I have a excel sheet containing locations(Store name. address,city,state,zip) and I want to develop
In an Excel sheet, I have roughly 30 rows x 100 columns of data.
I have an excel sheet that I am wanting to extract data from and
I have an Excel sheet now I need to insert data from that sheet
I have a excel sheet with cell value 0.010, 0.020 etc., I want to

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.