Why isn't formula pulling data? The Number is =to "FALSE" when ISNUMBER is performed......

ChrisOK

Well-known Member
Joined
Mar 26, 2003
Messages
601
Does anyone know why all of the formulas paste into the appropriate cell and activates (pulls the data from the destination cell) - EXCEPT FOR one!???

This one!
Code:
    Range("AC5").Formula = "=A5"
    'THE ABOVE ACTUAL CELL FORMULA IS:  =A5)

When I look at column "AC" it visibily shows all the formulas "=A5", "=A6", "=A7"... all the way down
whereas, it should be reflecing what is residing in those cells in column A!

I've checked the data in COLUMN A with "=ISNUMBER and it says: FALSE" even though it looks like a long part number... Is there some sort of adjustment to this line of code to make it work?

The data in A looks like this: 2840589857454PR

Code:
'-----------------------------------------------------------
    'THIS IS NEW CODE TO INSERT X THROUGH AC FORMULAS TO ACTIVATE SUMMARY TAB RESULTS
    'THIS SECTION PUTS IN ALL THE COL HEADERS OF "X THROUGH AD"
    
  
    Range("X4").Select
    ActiveCell.FormulaR1C1 = "NIIN"
    
    Range("Y4").Select
    ActiveCell.FormulaR1C1 = "STATUS"
    
    Range("Z4").Select
    ActiveCell.FormulaR1C1 = "Y1 DMDS"
    
    Range("AA4").Select
    ActiveCell.FormulaR1C1 = "Y2 DMDS"
    
    Range("AB4").Select
    ActiveCell.FormulaR1C1 = "TOT"
    
    Range("AC4").Select
    ActiveCell.FormulaR1C1 = "NSN"

    
'-----------------------------------------------------------

'INSERT X THROUGH AC FORMULAS TO ACTIVATE SUMMARY TAB RESULTS
'

    Range("X5").Formula = "=MID(A5,5,9)"
    'THE ABOVE ACTUAL CELL FORMULA IS:  =MID(A5,5,9)
    
    Range("Y5").Formula = "=COUNTIF(A:A, A5)>1"
    'THE ABOVE ACTUAL CELL FORMULA IS:   =COUNTIF(A:A, A5)>1
    
    Range("Z5").Formula = "=G5"
    'THE ABOVE ACTUAL CELL FORMULA IS:  =G5
    
    Range("AA5").Formula = "=I5"
    'THE ABOVE ACTUAL CELL FORMULA IS:  =I5
    
    Range("AB5").Formula = "=SUM(Z5+AA5)/730"
    'THE ABOVE ACTUAL CELL FORMULA IS:  =SUM(Z5+AA5)/730
    
    Range("AC5").Formula = "=A5"
    'THE ABOVE ACTUAL CELL FORMULA IS:  =A5)

    Range("X5:AC5").AutoFill Destination:=Range("X5:AC" & Range("A" & Rows.Count).End(xlUp).Row), Type:=xlFillDefault


'-----------------------------------------------------------
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi Chris

This will happen if the cell is formatted as Text. You can try it directly in the worksheet. Format a cell as Text and then write "=A1". You'll see that excel will take it as text.

In this case you can format the cell before adding the formula.

Ex.:


Code:
    Range("AC5").NumberFormat = "General" 
    Range("AC5").Formula = "=A5"


If this happens in more cells, instead of formatting the cells one by one you can also first set the format to all the cells where you'be be writing the formulas.

For ex.:

Code:
    Range("X5:Z5").NumberFormat = "General" 

    Range("X5").Formula = "=MID(A5,5,9)"
    'THE ABOVE ACTUAL CELL FORMULA IS:  =MID(A5,5,9)
    
    Range("Y5").Formula = "=COUNTIF(A:A, A5)>1"
    'THE ABOVE ACTUAL CELL FORMULA IS:   =COUNTIF(A:A, A5)>1
    
    Range("Z5").Formula = "=G5"
    'THE ABOVE ACTUAL CELL FORMULA IS:  =G5
 
Upvote 0
Love it! It works beautifully! (and thank you greatly for expanding upon the 2 ways of applying the formatting to ranges)
Going to make a mental note to remember this in the future.
Thanks again PGC01!
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,085
Members
452,378
Latest member
Hoodzy01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top