Results 1 to 2 of 2

Need Help for Run macro

Threaded View

  1. #1
    Registered User
    Join Date
    08-19-2012
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    1

    Need Help for Run macro

    I need replace text between {} with "class"

    Examle -- {aaaaaaaaaa} 4-6pm and {bbbbbbbbbb} 6-8 pm

    i need to replace above value class 4-6pm and class 6-8pm

    Sample file is alos attached.


    Here is my macro:-

    Option Explicit
    Sub BoldTextString()
    Dim s As String
    Dim r As Range, c As Range
    Dim re As Object, mc As Object, m As Object
    Dim i As Long

    Set r = Selection
    Set re = CreateObject("vbscript.regexp")
    re.Global = True
    re.ignorecase = True

    For Each c In r
    re.Pattern = "{[\s\S]+?(?=})"
    Set mc = re.Execute(c.Text)
    re.Pattern = "{|}"
    c.Value = re.Replace(c.Text, "")
    i = 0
    For Each m In mc
    With c.Characters(m.firstindex + 1 - 3 * i, _
    m.Length - 1)
    .insert = ("class")
    .Font.Bold = True
    .Font.Underline = True
    .Font.Size = 11

    End With

    i = i + 1
    Next m
    Next c
    End Sub



    Thanks in advance.


    REgards
    Sourabh
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using a macro on workbook1 to create a button in wb2 and assigning macro "wb2!macro"
    By penfold1992 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2014, 11:39 AM
  2. [SOLVED] Macro to show Which macro didnt work in a nested macro
    By akhileshgs in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-10-2013, 03:21 AM
  3. Perform macro "on open" specific file- store macro in Personal Macro Workbook?
    By thompssc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2012, 12:38 PM
  4. lookup macro, solver macro, realtime macro
    By xelhelp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-02-2011, 06:14 PM
  5. Cannot find macro error when running a macro from a macro in a diffrent workbook.
    By Acrobatic82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 09:22 AM

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