ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting ' in front of text in a cell (https://www.excelbanter.com/excel-programming/412147-deleting-front-text-cell.html)

iashorty

Deleting ' in front of text in a cell
 
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?

Mike H

Deleting ' in front of text in a cell
 
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?


Per Jessen[_2_]

Deleting ' in front of text in a cell
 
On 5 Jun., 22:05, 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?


Hi

Look at this

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

Regards,
Per

Tim Zych

Deleting ' in front of text in a cell
 
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" wrote in message
...
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?




iashorty

Deleting ' in front of text in a cell
 
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" wrote in message
...
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?






All times are GMT +1. The time now is 10:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com