Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

add one or more characters to the end of all selected cells in excel

Posted on 2013-06-10
3
Medium Priority
?
285 Views
Last Modified: 2013-06-10
I am trying to change the formula in a selected area of an excel 2010 spreadsheet to include the expression iferror(*," ").  Where * is any expression currently to the right of the = sign.  In other words I would want to change =f8 to =iferror(f8," ").   I can figure out how to put 'iferror(' after the = sign by search and replace (and first puting ' in front so it doesn't execute, then getting rid of the ' once I am finished).  I can't figure out a way to tack the
expression ," ") to the end of every expression.  I assume some method using wildcards might work.  I don't really want to write a VB script.  But if thats the only way to do it, then I would be happy to listen to how to use that.
0
Comment
Question by:dma70
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 39235743
Wildcards won't help in this case since the replace function does not understand the notion of "include in the replace string the part covered by the wildcard character(s)".

You will have to use a VBA macro to do the work.

Kevin
0
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 1600 total points
ID: 39235769
A macro to do the work:

Public Sub AddErrorHandling()

    Dim Cell As Range
   
    For Each Cell In Selection
        If Cell.HasFormula Then
            If Not Left(Cell.Formula, 9) = "=IFERROR(" Then
                Cell.Formula = "=IFERROR(" & Mid(Cell.Formula, 2) & ","""")"
            End If
        End If
    Next Cell

End Sub

Kevin
0
 
LVL 1

Author Closing Comment

by:dma70
ID: 39235840
works great - thank you
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question