Amend code

Posted on 2012-09-14
Last Modified: 2012-09-14

Can someone amend the attached code so it does not convert the whole used range.

I just want column C to be converted


Sub chge()
For Each c In ActiveSheet.UsedRange
If IsNumeric(c) Then
c.Value = "'" & c.Value
End If
Next c
Question by:Seamus2626
    LVL 44

    Accepted Solution

    Dim LastRowColC As Long
    Dim lngIndex As Long
    LastRowColC = Range("C65536").End(xlUp).Row
    For lngIndex = 1 to LastRowColC
        If IsNumeric(Range("C" & lngIndex).Value) Then
            Range("C" & lngIndex).Value = "'" & Range("C" & lngIndex).Value
        End If

    Open in new window


    Author Closing Comment

    LVL 44

    Expert Comment

    by:Martin Liss
    You're welcome and I'm glad I was able to help.

    Marty - MVP 2009 to 2012

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I've recently been in need of an Excel macro that could add a letter before the text on multiple cells in an Excel document. My English is as it is, so I will try explain what it does diffrently. If you have an excel document with 2000 rows an…
    Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
    The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
    This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now