• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 103
  • Last Modified:

VB Script to Change Yes/No value to True/False

I have some worksheet data that is imported from a work application, and some values show up and Yes/No but my boss, for whatever reason known only to him, wants these values changed to True/False.  Currently this data resides in column D:D.  I am struggling to figure out how to do this via vb code.  Any suggestions?
1 Solution

pls try

    Range("D:D").Replace What:="Yes", Replacement:="True", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    Range("D:D").Replace What:="NO", Replacement:="False", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

Open in new window

How is the data imported? What is the driver to use VBA rather than just find/replace? Are the values in D:D only ever Yes or No? Is there scope for inserting column E and using a formula driven by the values in D rather than resorting to VBA? How often will this import / transformation process need to take place?
Any other info to help us more fully understand the requirement?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now