Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 80
Default Deleting first character issue

This macro deletes first character of each cell in a range. But if there is
black cell in the begining or in between cells it does not work.
Is there any way to overcome this issue.

thx.

Sub RemoveQuote()
On Error GoTo e
Dim rng As Range, cell As Object
Set rng = Selection
For Each cell In rng
cell = Right(cell, Len(cell) - 1)

Next cell
e:
End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...l-new/200802/1

  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,290
Default Deleting first character issue


Sub RemoveQuote_R1()
On Error GoTo e
Dim rng As Range, cell As Range
Set rng = Selection
For Each cell In rng.Cells
If cell.HasFormula = False Then
If Len(cell.PrefixCharacter) 0 Then
cell.Value = cell.Value
ElseIf Len(cell.Value) 0 Then
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
End If
End If
Next 'cell
e:
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"saman110 via OfficeKB.com"
wrote in message
This macro deletes first character of each cell in a range. But if there is
black cell in the begining or in between cells it does not work.
Is there any way to overcome this issue.
thx.

Sub RemoveQuote()
On Error GoTo e
Dim rng As Range, cell As Object
Set rng = Selection
For Each cell In rng
cell = Right(cell, Len(cell) - 1)
Next cell
e:
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel-Match 1st text character in a string to a known character? bushlite Excel Worksheet Functions 2 January 15th 07 06:36 PM
Deleting the "'" character in the text formula John Excel Discussion (Misc queries) 6 November 23rd 06 12:47 PM
Deleting cell data without deleting formula Tom Hall Excel Discussion (Misc queries) 4 October 29th 06 04:07 PM
Deleting the same character automatically in each cell fuzzyjon Excel Worksheet Functions 3 May 15th 06 02:45 PM
how prevent formula in cell from deleting when deleting value???? sh-boom New Users to Excel 1 September 30th 05 06:12 PM


All times are GMT +1. The time now is 02:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"