+ Reply to Thread
Results 1 to 10 of 10

to find and replace the special character in multiple worksheet in a workbook

  1. #1
    Registered User
    Join Date
    10-10-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2010
    Posts
    12

    to find and replace the special character in multiple worksheet in a workbook

    Hi,
    I have a one excel workbook which has multiple worksheet,In each sheet i need to find (" and replace it with ' (single code) automatically.Can some one suggest me a macro or vba code.I have attached the workbook

    Thanks
    Vinutha
    Attached Files Attached Files

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: to find and replace the special character in multiple worksheet in a workbook

    Here you go

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: to find and replace the special character in multiple worksheet in a workbook

    in the sheet name LEGAL_LOT_ID, there are also " in column "E"

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: to find and replace the special character in multiple worksheet in a workbook

    Good catch AB33. This should do it.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: to find and replace the special character in multiple worksheet in a workbook

    Mike,
    your first code also works on this

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-10-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: to find and replace the special character in multiple worksheet in a workbook

    Hi Mike ,
    Thanks for your reply,I will save the above code in macro,and call this macro through VBA script .The VBA script will run the macro.my question is where i will give the input filename ,so it will pick only the partcular workbook and run the macro on it,because ,i have lots of incoming reports in the folder and i want to apply this macro on only excel book name Result as i have attached in the above thread.I dont want to run the macro manually
    .I am calling it through VBA script.

    Thanks,
    Vinutha

  7. #7
    Registered User
    Join Date
    10-10-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: to find and replace the special character in multiple worksheet in a workbook

    hi Mike,
    I have saved this below code in excel sheet find.xlsm
    Sub abc()
    Dim ws As Worksheet

    For Each ws In Worksheets
    ws.Range("a1").CurrentRegion.Replace What:="(""", Replacement:="'", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
    Next
    End Sub.

    Later i want to run this macro on result.xlsx workbook.I cant save this macro on the result.xlsx.because each time the result sheet is getting generated in the folder.So i wanted the macro to be on different sheet and call it on the result sheet thorugh VB script:

    Option Explicit
    Dim xlApp, xlBook
    Set xlApp = CreateObject("Excel.Application")
    Set xlBook = xlApp.Workbooks.Open("D:\test\Result.xlsx", 0, True)
    xlApp.Run "'d:\test\find.xlsm'!replace"
    Set xlBook = Nothing
    Set xlApp = Nothing
    xlApp.DisplayAlerts = False
    xlApp.ActiveWorkbook.Close
    xlApp.Quit
    Set xlBook = Nothing
    Set xlApp = Nothing
    End Sub

    this is the code which i tried,but no luck...can you please correct this code

  8. #8
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: to find and replace the special character in multiple worksheet in a workbook

    Why not just save the code in your Personal macro Workbook. Then when you open the Results.xlsx file hit Alt F8 and youll see the macro there.

    Please Login or Register  to view this content.
    Last edited by mike7952; 10-11-2012 at 09:01 AM.

  9. #9
    Registered User
    Join Date
    10-10-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: to find and replace the special character in multiple worksheet in a workbook

    there should not be any manual intervention,everything should be automated.I am using an application which will call the vbscript and it should replace the characters in the excel sheet,because these reports goes to client,where they can only view the file.We will not be having access to the folder where these result sheets are getting generated.
    please help me on automating :-(

  10. #10
    Registered User
    Join Date
    10-10-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: to find and replace the special character in multiple worksheet in a workbook

    there should not be any manual intervention,everything should be automated.I am using an application which will call the vbscript and it should replace the characters in the excel sheet,because these reports goes to client,where they can only view the file.We will not be having access to the folder where these result sheets are getting generated.
    please help me on automating :-(

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1