Amend code

Hi,

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

I just want column C to be converted

Thanks

Sub chge()
For Each c In ActiveSheet.UsedRange
If IsNumeric(c) Then
c.Value = "'" & c.Value
End If
Next c
Seamus2626Asked:
Who is Participating?
 
Martin LissConnect With a Mentor Older than dirtCommented:
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
Next

Open in new window

0
 
Seamus2626Author Commented:
Thanks!
0
 
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2012
0
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.

All Courses

From novice to tech pro — start learning today.