+ Reply to Thread
Results 1 to 12 of 12

Macro for Shifting cell reference between worksheets

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

    Macro for Shifting cell reference between worksheets

    I made a quick exanple to demonstrate what I need

    wk1 has a group of cell filled in red and named "Shiftschedule"

    The defined cells in wk1 look at ws "ScheduleTablet" for information. I am looking for a macro to take the reference cells and shift down 21 rows each - I am open to options - but this one is beyond my experience - THANKS!!!

    in otherwords wk1

    Before Macro
    A3=ScheduleTablet!B3
    A4=ScheduleTablet!B4
    A5=ScheduleTablet!B5
    A6=ScheduleTablet!B6


    After Macro
    A3=ScheduleTablet!B24
    A4=ScheduleTablet!B25
    A5=ScheduleTablet!B26
    A6=ScheduleTablet!B27


    A3=ScheduleTablet!B45......
    Attached Files Attached Files
    Last edited by clundeen; 10-25-2011 at 05:58 PM.

  2. #2
    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.

  3. #3
    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

    Please Login or Register  to view this content.
    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

  4. #4
    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?

  5. #5
    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

  6. #6
    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")?

  7. #7
    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

    Here is what I have - getting mismatch error

    highlighting - Cell.Formula = Left(Cell.Formula, i_Len) & Right(Cell.Formula, Len(Cell.Formula) - i_Len) + 21
    Attached Files Attached Files

  8. #8
    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 - UNSOLVED!!

    just replace i_len with 17 buddy should be fine

  9. #9
    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 - UNSOLVED!!

    As for the multiple ranges yes you're almost there:

    Please Login or Register  to view this content.
    Hope that helps and please add to my rep

    Ta

  10. #10
    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 - UNSOLVED!!

    GREAT!!!!

    Last bit of clean up - I have 3 separate ws that are all linked to same master ScheduleTablet

    wk1, wk2, wk3 (duplicated form so they has same set of cells) just different rows they refer to

    wk1 A3:A6 = ScheduleTablet!B3:B6
    wk2 A3:A6 = ScheduleTablet!B10:B13
    wk3 A3:A6 = ScheduleTablet!B17:B20

    Do I need to add anything to cover these added ws?

    I will comment on you merit for sure!!!!!

  11. #11
    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 - UNSOLVED!!

    What does the 17 mean? Sorry for being a pain - I am trying to learn so I won't need as much help

  12. #12
    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 worksheets

    Hi clunden its the length in characters of the sheetname and the "!B" bit together

+ 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