+ Reply to Thread
Results 1 to 12 of 12

Macro for Shifting cell reference between worksheets

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-11-2011
    Location
    Milwaukee, WI
    MS-Off Ver
    Excel 2003
    Posts
    107

    Re: Macro for Shifting cell reference between ws

    I thought of another option that may be easier to structure - take ws ScheduleTablet and add 21 rows above my info and have those be a copy of

    In other words

    Rows 1-21 = Rows 22-42
    run macro and
    Rows 1-21 = Rows 43-63

    Also
    I could add columns to left of and have my info on right and the have macro delete T1:AL21
    Last edited by clundeen; 10-25-2011 at 07:51 AM.

  2. #2
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Re: Macro for Shifting cell reference between ws

    Try This

    Sub ChangeFormula()
    Dim Cell As Range
    Dim ShtName as String
    Dim i_Len as integer
    
    ShtName = "ScheduleTablet!B"
    i_Len = Len(ShtName)
    
    
    For Each Cell In Range("A3:A6")
            Cell.Formula = Left(Cell.Formula, i_Len) & Right(Cell.Formula, Len(Cell.Formula) - i_Len) + 21
    Next Cell
    End Sub
    Let me know how it goes.
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

  3. #3
    Forum Contributor
    Join Date
    01-11-2011
    Location
    Milwaukee, WI
    MS-Off Ver
    Excel 2003
    Posts
    107

    Re: Macro for Shifting cell reference between ws

    Which option is this written for?

  4. #4
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Re: Macro for Shifting cell reference between ws

    option 1 mate

  5. #5
    Forum Contributor
    Join Date
    01-11-2011
    Location
    Milwaukee, WI
    MS-Off Ver
    Excel 2003
    Posts
    107

    Re: Macro for Shifting cell reference between ws

    Did you edit your post? I tried it on my test wb and it worked great - now your post looks different and I can't get it to work Runtime error - wierd

    Also - How do I handle the multiple groups?

    For Each Cell In Range("A3:A6")

    For Each Cell In Range("A3:A6") ("A9:A12") ("A15:A18") or do I put them as ("A3:A6, "A9:A12, "A15:A18")?

+ 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