PC Review


Reply
Thread Tools Rate Thread

Deleting ' in front of text in a cell

 
 
iashorty
Guest
Posts: n/a
 
      5th Jun 2008
I have several cells that I need to delete the ' in front of text in that
cell. How do I write the code for this in VBA?
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      5th Jun 2008
Hi,

Right click your sheet tab, view code and paste this in and run it.

Sub stantial()
Application.ScreenUpdating = False
For Each c In ActiveSheet.UsedRange
If Not c.HasFormula Then
c.Value = c.Text
End If
Next
Application.ScreenUpdating = True
End Sub

Mike

"iashorty" wrote:

> I have several cells that I need to delete the ' in front of text in that
> cell. How do I write the code for this in VBA?

 
Reply With Quote
 
Per Jessen
Guest
Posts: n/a
 
      5th Jun 2008
On 5 Jun., 22:05, iashorty <iasho...@discussions.microsoft.com> wrote:
> I have several cells that I need to delete the ' in front of text in that
> cell. How do I write the code for this in VBA?


Hi

Look at this

Range("A1").Value = Mid(Range("A1").Value, 1)

Regards,
Per
 
Reply With Quote
 
Tim Zych
Guest
Posts: n/a
 
      5th Jun 2008
If this is a contiguous block of data, select it and run

With Selection
.Value = .Value
End With

or this will work for everything. Select the cells and run

Dim cell As Range
For Each cell In Selection.Cells
cell.Value = cell.Value
Next

--
Tim Zych
www.higherdata.com
Compare data in worksheets and find differences with Workbook Compare
A free, powerful, flexible Excel utility



"iashorty" <(E-Mail Removed)> wrote in message
news:C00FEB58-27DD-434D-9DD3-(E-Mail Removed)...
>I have several cells that I need to delete the ' in front of text in that
> cell. How do I write the code for this in VBA?



 
Reply With Quote
 
iashorty
Guest
Posts: n/a
 
      9th Jun 2008
Thanks, Tim. This worked for me and I was able to understand what I was doing.

IAShorty


"Tim Zych" wrote:

> If this is a contiguous block of data, select it and run
>
> With Selection
> .Value = .Value
> End With
>
> or this will work for everything. Select the cells and run
>
> Dim cell As Range
> For Each cell In Selection.Cells
> cell.Value = cell.Value
> Next
>
> --
> Tim Zych
> www.higherdata.com
> Compare data in worksheets and find differences with Workbook Compare
> A free, powerful, flexible Excel utility
>
>
>
> "iashorty" <(E-Mail Removed)> wrote in message
> news:C00FEB58-27DD-434D-9DD3-(E-Mail Removed)...
> >I have several cells that I need to delete the ' in front of text in that
> > cell. How do I write the code for this in VBA?

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I stop Word from deleting my text when I type in front of it? =?Utf-8?B?QXNobGV5IEF1dHVtbg==?= Microsoft Word Document Management 2 12th Sep 2006 06:24 PM
How can I center text on a picture in a cell in Front Page? =?Utf-8?B?QyBOZWxzb24=?= Microsoft Frontpage 2 9th Aug 2006 09:38 AM
Front Page 2003 cell text =?Utf-8?B?QmlnIFBhbnRz?= Microsoft Frontpage 2 23rd May 2006 04:34 PM
Formula for adding a comma in front of text in a cell =?Utf-8?B?U2hlbGxleQ==?= Microsoft Excel Worksheet Functions 4 18th Apr 2005 04:34 PM
Deleting Rows based on text in cell & formatting cell based on text in column beside it =?Utf-8?B?U3RldmU=?= Microsoft Excel Programming 4 26th Feb 2004 03:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:09 AM.