+ Reply to Thread
Results 1 to 11 of 11

Enter formula to add the cell to the left plus + 1

  1. #1
    Forum Contributor
    Join Date
    06-26-2014
    Location
    Houston
    MS-Off Ver
    365
    Posts
    196

    Enter formula to add the cell to the left plus + 1

    Hey guys and gals,

    In VBA, I am trying to add a formula to the active cell, which would add the cell to the left plus 1. I just cant figure this out. Thanks in advance!

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,803

    Re: Enter formula to add the cell to the left plus + 1

    A lot of times, people will use R1C1 notation when writing formulas in VBA, because it simplifies many of these operations. In this case, it seems like it should be as simple as
    Please Login or Register  to view this content.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Contributor
    Join Date
    06-26-2014
    Location
    Houston
    MS-Off Ver
    365
    Posts
    196

    Re: Enter formula to add the cell to the left plus + 1

    Thats great!

  4. #4
    Forum Contributor
    Join Date
    06-26-2014
    Location
    Houston
    MS-Off Ver
    365
    Posts
    196

    Re: Enter formula to add the cell to the left plus + 1

    I am trying to ask another question with some code in the post, but it will not let me post. It takes me to a site that says it was blocked because an SQL injection was detected. Any idea why this is happening? I attached a screenshot.

    Attachment 648632

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Enter formula to add the cell to the left plus + 1

    Do you have multiple Replace functions, or anything that looks like SQL?
    Rory

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,401

    Re: Enter formula to add the cell to the left plus + 1

    Quote Originally Posted by rorya View Post
    Do you have multiple Replace functions, or anything that looks like SQL?
    If your answer to rorya's question is "I am not sure", then try placing a space character after the opening paragraph for each function in the offending code line and see if that works when posting your code.

  7. #7
    Forum Contributor
    Join Date
    06-26-2014
    Location
    Houston
    MS-Off Ver
    365
    Posts
    196

    Re: Enter formula to add the cell to the left plus + 1

    No replace function, and I'm not sure what SQL looks like. Its just 5 lines of moving the activated cell around the sheet to get to a certain cell, then moving one cell over and entering a formula. I'm trying to loop it until the cell that is activated contains the word End. Sorry for the screenshot rather than code, but it isnt seeming to work.Attachment 648638 Thank you so much!

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Enter formula to add the cell to the left plus + 1

    That attachment hasn't worked.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  9. #9
    Forum Contributor
    Join Date
    06-26-2014
    Location
    Houston
    MS-Off Ver
    365
    Posts
    196

    Re: Enter formula to add the cell to the left plus + 1

    How about now? Thanks for your help.
    Attached Images Attached Images

  10. #10
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,885

    Re: Enter formula to add the cell to the left plus + 1

    It may be all the Select statements. The firewall here is a little paranoid.

    Can you explain in words exactly what you're trying to do, as I can't really see the point of looping that? A sample workbook wouldn't go amiss either...

  11. #11
    Forum Contributor
    Join Date
    06-26-2014
    Location
    Houston
    MS-Off Ver
    365
    Posts
    196

    Re: Enter formula to add the cell to the left plus + 1

    Sure thing.

    So the point of this is to insert a new column each day to the right of the most recent dated column, in this case, G. So it would insert a new column in H.
    Then it would add the current date, which cant be TODAY because it needs to not change each day, hence the add +1 to the previous day. It would need to do this for
    each row that has a date. So new blank column for H, then current date in H1, H9, H17, H23, and H26, then stop the code. I have attached a before and after.
    This is a shortened version, there are a lot more dates that would need to be entered, so it cant just be choosing these certain cells. Thanks!
    Attached Files Attached Files

+ 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. Formula to move data to Left when LEFT cell is blank?
    By wer5150 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2019, 05:26 AM
  2. Formula to move data to Left when LEFT cell is blank?
    By wer5150 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-31-2019, 05:22 AM
  3. [SOLVED] If cell has a value then enter cell to the left
    By Moxy Fruvous in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-24-2018, 09:46 PM
  4. Macro to enter todays date in an active cell then delete contents of cell to left
    By Ted Dennis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2015, 09:50 AM
  5. Require Double Left Click to Enter Data Into Cell
    By jaslake in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-28-2011, 12:31 AM
  6. Replies: 6
    Last Post: 06-30-2006, 01:55 AM

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