+ Reply to Thread
Results 1 to 2 of 2

Help in this code for range with varibale

Hybrid View

  1. #1
    Registered User
    Join Date
    10-26-2004
    Posts
    8

    Help in this code for range with varibale

    I have a code as

    Range("D14", "Q14").UnMerge it's working fine when i give the number

    But when i put this in a loop as

    For i =1 to ActiveSheet.UsedRange.Rows.Count
    Range("D &i", "Q &i").UnMerge
    next i


    It's not working ..


    Can anyone help on this ..?

    Thanks

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996
    You are including "i" in the quotes which treats it as the letter i, not the variable. Try this:

    For i =1 to ActiveSheet.UsedRange.Rows.Count
    Range("D" & i, "Q" & i).UnMerge
    next i

    Does that help?

    Ron

+ 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