+ Reply to Thread
Results 1 to 8 of 8

Substitute code partly working

Hybrid View

drewship Substitute code partly working 01-19-2010, 03:08 PM
StephenR Re: Substitute code partly... 01-19-2010, 03:20 PM
Domski Re: Substitute code partly... 01-19-2010, 03:20 PM
rwgrietveld Re: Substitute code partly... 01-19-2010, 03:53 PM
StephenR Re: Substitute code partly... 01-19-2010, 03:58 PM
drewship Re: Substitute code partly... 01-19-2010, 03:26 PM
rwgrietveld Re: Substitute code partly... 01-19-2010, 04:12 PM
StephenR Re: Substitute code partly... 01-19-2010, 04:54 PM
  1. #1
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Substitute code partly working

    I think you missed some .'s:

    With Sheets("Class Roster Template")
        For Each rng In .UsedRange
            rng = WorksheetFunction.Substitute(rng, "/", "")
        Next rng
    End With
    
    With Sheets("Class Roster Template")
    For Each rng1 In .Range("J2", .Range("J2").End(xlDown))
            rng1 = WorksheetFunction.Substitute(rng1, "M", "L")
        Next rng1
    End With
    You could also use Find/Replace instead of the Substitute function.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Substitute code partly working

    The dots in the suggested code(s) works.

    Nevertheless I feel I must comment
    Range(rangeA, rangeB)
    will return a range from A to B

    As this range is on the same sheet use
    Range(.range("J2"), .range("J2").end(xldown))
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Substitute code partly working

    rwgrietveld: is that really necessary?

+ 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