Amend code

Posted on 2012-09-14
Medium Priority
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
  • 2
LVL 50

Accepted Solution

Martin Liss earned 2000 total points
ID: 38399190
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

ID: 38399240
LVL 50

Expert Comment

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

Marty - MVP 2009 to 2012

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

850 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