+ Reply to Thread
Results 1 to 6 of 6

Macro Mid Formula Not Working

  1. #1
    Registered User
    Join Date
    11-28-2011
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    73

    Macro Mid Formula Not Working

    I have a small macro and within that macro I need to grab 16 digits out of a string of mixed characters and numbers. So as an example I need the first 16 digits after;
    ZA874635496587695854768969780456
    and this copies down the entire column. .Range("B2:B" & .Cells(.Rows.Count, "A").End(xlUp).Row).Formula = "=MID(A2,3,16)" The problem is, it only grabs 15 numbers and gives me a zero for the 16th. I have tried increasing the amount of numbers and it always pulls 15 and then spits out zeros???

    Any insight would be appreciated.

    Thanks!

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro Mid Formula Not Working

    Wrong assumption.
    Last edited by AB33; 11-08-2016 at 04:30 PM.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Macro Mid Formula Not Working

    The code works fine for me, how is column B formatted?

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    11-28-2011
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Macro Mid Formula Not Working

    Quote Originally Posted by Norie View Post
    The code works fine for me, how is column B formatted?

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.
    Just to be certain I put a piece in the macro to format the column first and it didn't help. If I change the .Formula = "=MID(A2,3,16) to 17, 18, 19, it just increases the amount of zeros I get after the 15th digit. A sample? I can try to put one together with fictitious #'s because the original is sensitive.

  5. #5
    Registered User
    Join Date
    11-28-2011
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Macro Mid Formula Not Working

    Quote Originally Posted by AB33 View Post
    Wrong assumption.
    How so? Can you elaborate?

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro Mid Formula Not Working

    You could try on formula. Use the mid function in excel and see if it returns the correct data.

+ 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] help index and match macro not working but formula working??
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-28-2016, 06:37 AM
  2. [SOLVED] Formula not working in Macro
    By mstoto in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-06-2015, 09:50 AM
  3. Formula in macro not working
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-06-2014, 03:44 PM
  4. [SOLVED] Formula not working within macro
    By theletterh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-13-2013, 12:32 PM
  5. formula is not working in macro
    By Jamnes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2012, 10:32 AM
  6. Formula to cell with macro not working
    By tneva in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-26-2009, 09:26 AM
  7. Macro formula using MYDATE not working
    By Bricktop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2005, 03:05 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