+ Reply to Thread
Results 1 to 3 of 3

Formula VBA inside corresponding cell, help?

  1. #1
    Registered User
    Join Date
    01-19-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    2

    Formula VBA inside corresponding cell, help?

    Hello everyone,

    I am new to the forums and fairly new to VBA as well, I have been trying to solve this problem I've been getting and can't seem to fix it correctly. This is what I'm trying to do.

    idformulaworks.JPG

    This formula in the T column produces a unique ID for "new customers" every time there is an input in the P row. =IF(P4="","",CONCATENATE("S16",LEFT("00000",5-LEN(ROW(T4)-3)),ROW(T4)-3))
    However, when adding the information for a "previous customer" with another User Form I created, that cell gets overwritten with the "previous customer's" Unique ID. In this event every S1600001

    IdsOver.JPG

    So now every time a "previous customer's" information is added his/her unique ID gets hard coded into the respective cell (No more formula), which won't cause a problem except that...

    I have a Delete button which clears all of the "Customers" information (except columns with formulas) in the row of your choice. The problem arises when you delete a "previous customer's" information as the cell with the ID had already lost the formula it had in the beginning. What I am trying to do is the moment I confirm I want to delete the information, I want the macro to input the formula again to the respective ID cell.

    This is my Delete Button VBA code.

    Please Login or Register  to view this content.
    This is the error I am getting when running the macro:

    Debug issue.JPG

    And this is the row it highlights when I click on debug.

    highlight issue.JPG

    I think that the problem is the way I am setting up the Range Object, it is not accepting me the .Formula range4.Range(number).Formula but I am not sure because with .ClearContents it works perfectly on the other range variables. Either that or that is just not the way to write a formula in VBA, I don't know if it accepts CONCATENATE inside the formula on VBA, I have seen other formulas where they use Application.WorksheetFunction. Not sure what the rules are on that.

    Any help would be really appreciated!

    Thanks!

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Formula VBA inside corresponding cell, help?

    How about
    Please Login or Register  to view this content.
    David
    (*) Reputation points appreciated.

  3. #3
    Registered User
    Join Date
    01-19-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    2

    Re: Formula VBA inside corresponding cell, help?

    It gives me the same error, and if I delete the Rows(number) part it won't go to the exact row for the cell I want to delete for the T column. In reality the formula eventually has to be changed to something like this:

    "=IF(Pnumber="""","""",CONCATENATE(""s16"",LEFT(""00000"",5-LEN((ROW(tnumber-3)),ROW(Tnumber)-3)" The 4s in P4 and T4s need to address the row number inputted in the User Form Delete.

+ 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. Can I call a cell value from inside a formula?
    By thepinkgeologist in forum Excel General
    Replies: 6
    Last Post: 04-01-2015, 11:42 AM
  2. Can cell reference inside formula be derived from another cell?
    By kmarie630 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-07-2014, 01:52 PM
  3. Replies: 10
    Last Post: 04-27-2014, 08:16 AM
  4. ignore cell inside formula
    By kimizito in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-29-2013, 02:34 PM
  5. Replace tab value inside formula with cell value
    By Haywire in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 02-10-2010, 04:04 PM
  6. Change Cell Ref inside a formula
    By dht in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-04-2006, 06:20 PM
  7. Using a value from a cell inside a formula!
    By marsupilami in forum Excel General
    Replies: 5
    Last Post: 08-24-2005, 02:06 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