+ Reply to Thread
Results 1 to 17 of 17

Offset Cell content VBA

  1. #1
    Registered User
    Join Date
    05-22-2014
    Posts
    16

    Offset Cell content VBA

    Hi All,

    I am looking for a vba to offset the cells.

    The code I have currently is;




    Please Login or Register  to view this content.
    This is only moving the selected cells across one, however - the content of the cells is what I wish to move so cell C25 has data pointing to another sheet cell A1 i.e. =Sheet1!$A$1 - can I edit this code so it alters the cell to reference B1, C1 etc....

    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Offset Cell content VBA

    Is this one question or multiple? Are you looking to offset cursor from the selected cells or move data of selected cells to a different location or edit cells so that those cells will have a reference (hyperlink kind) to other cells?

  3. #3
    Registered User
    Join Date
    05-22-2014
    Posts
    16

    Re: Offset Cell content VBA

    I am looking for the cells to remain in C25:D28 and simply edit those cells that reference sheet1 - the hyperlink kind so any given time I offset them it will reference the next column firstly B, then a week later C and so on....

    I will do this every Tuesday

  4. #4
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Offset Cell content VBA

    Still an example sheet might help

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Offset Cell content VBA

    You would need to take out the $ signs in your formula.

    =Sheet1!A1

  6. #6
    Registered User
    Join Date
    05-22-2014
    Posts
    16

    Re: Offset Cell content VBA

    Doesn't work just removing the dollar signs, simply shifts the cell focus along one and cells C25 etc… are still viewing Sheet1!A1

  7. #7
    Registered User
    Join Date
    05-22-2014
    Posts
    16

    Re: Offset Cell content VBA

    Sheet now attached.

    Source data in Completions tab.

    Data I wish to edit every Tuesday is in cells C5:D8 and I6 to I9.

    I've added both macros separate and wish to combine and if not relevant then skip to the next command please anyone.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-22-2014
    Posts
    16

    Re: Offset Cell content VBA

    bump bump.

    Still struggling here.

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Offset Cell content VBA

    If I understand correctly, below code should work to update C5 to D8.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    05-22-2014
    Posts
    16

    Re: Offset Cell content VBA

    Quote Originally Posted by haripopuri View Post
    If I understand correctly, below code should work to update C5 to D8.
    Please Login or Register  to view this content.
    It's failing on the line in bold above? Run-time error 1004 - Method 'Range' of object '_Global' Failed?

  11. #11
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Offset Cell content VBA

    Hi DaveMurray23,
    haripopuri's code works for me
    also try this
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    05-22-2014
    Posts
    16

    Re: Offset Cell content VBA

    This is working great nilem - thanks so much!

    Haripopuri - thank you for your input I am going to try and crack yours as well and make sure it's not something I'm doing!

    Both of you thanks!!

    Quote Originally Posted by nilem View Post
    Hi DaveMurray23,
    haripopuri's code works for me
    also try this
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    05-22-2014
    Posts
    16

    Re: Offset Cell content VBA

    Ahhhh it's working for C range but not I range and error message keeps appearing when trying to create a new one for that specific range??

  14. #14
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Offset Cell content VBA

    Is this question for me?
    Can you show the file where the error occurs

  15. #15
    Registered User
    Join Date
    05-22-2014
    Posts
    16

    Re: Offset Cell content VBA

    Yes please nilem

    The code you gave works perfect for C5:D8 and doesn't give any errors it simply skips updating I6:19

    When I then try to create a new one adjusting the range the error comes in this part of the code;

    Please Login or Register  to view this content.

  16. #16
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Offset Cell content VBA

    Hi DaveMurray23,
    Please check the attached file
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    05-22-2014
    Posts
    16

    Re: Offset Cell content VBA

    Thanks so much - working perfectly now!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Worksheet change event code to display message box based on active cell offset content
    By Nitefox in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2014, 02:52 PM
  2. [SOLVED] How to autofill a column with a cell content depending on content in another cell.
    By lul1971 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-17-2012, 12:33 PM
  3. copying cell content into a specific workbook based on the content in that cell
    By krishna reddy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2012, 03:52 AM
  4. Replies: 2
    Last Post: 12-19-2006, 10:50 PM
  5. Searching array for date and changing offset colour depeding on combobox content?
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-02-2006, 07:15 PM

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