Hi Ranjan,
 
Please try this.
 
Sub RemovePunctuation()
    Dim arrPunc                     As Variant
    Dim lngLoop                     As Long
    Dim rngCol                      As Range
    Dim rngRange                    As Range
    
    
    arrPunc = Array(".", "!", ":", ";", "-", "#", "(", ")", "[", "]", "'", 
"""", "/", ",")
    
    Set rngRange = ActiveSheet.Range("A1:L1")
    
    For Each rngCol In rngRange
        If Not LCase(rngCol.Value) Like "*date*" Then
            For lngLoop = LBound(arrPunc) To UBound(arrPunc) - 1
                rngCol.EntireColumn.Replace What:=arrPunc(lngLoop), 
Replacement:="", LookAt:=xlPart, _
                SearchOrder:=xlByRows, MatchCase:=False, 
SearchFormat:=False, _
                ReplaceFormat:=False
            Next lngLoop
        Else
            For lngLoop = LBound(arrPunc) To UBound(arrPunc) - 1
                If arrPunc(lngLoop) <> "/" Then
                    rngCol.EntireColumn.Replace What:=arrPunc(lngLoop), 
Replacement:="", LookAt:=xlPart, _
                    SearchOrder:=xlByRows, MatchCase:=False, 
SearchFormat:=False, _
                    ReplaceFormat:=False
                End If
            Next lngLoop
        End If
    Next rngCol
End Sub
 
 
Regards,
Lalit Mohan
 

On Wednesday, 27 June 2012 14:38:38 UTC+5:30, Bhaity wrote:

> Dear experts,
>
>
> Is there any VBA code to remove punctuation in  a sheets ? 
>
> ------ i am doing it manually by ctr + H (replacing the desire punctuation 
> with "") and it takes many times to remove huge data.
>
>   so is there any coding for removing punctuation at a time ? 
>
>  
> Thanks & Regards,
> *Deba Ranjan P*
>
>
> ****
>

-- 
-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com


Reply via email to