HI Everyone,
I am needing a fix for a cell returning a value of '0' when pulling data from a closed workbook. I have two workbooks, one houses all my data that practically remains closed, the other is the active workbook used by my team which pulls data from the closed workbook:
I have the active workbook pulling data from the closed workbook via the following code:
Option Explicit
Sub GetData_SystemCodes()
GetData ThisWorkbook.Path & "\Test_Test_v1.xlsm", "Codes", _
"A2:E163", Sheets("Codes").Range("A3"), True, True
End Sub
The problem I am having is when running this macro and pulling the data from the closed workbook to the active workbook, for example if cells E140:E150 are blank on the closed wookbook, they are returning a value of ;0' on the active workbook.
I have tried Conditional Formatting, I have tried formatting the cells with '0;-0;;@' and still nothing works. Also on the cells that are returning with a 0 value, I get an error of "The number in this cell is formated as text or preceded by an apostrophe".
I am not sure what exactly is causing this error or how to return a blank cell when the cell on the closed workbook is blank. If it helps i am using the following code on the closed workbook in the cell the data is being pulled from:
Code:
=IF(ISERROR(VLOOKUP(A2,SystemCodes!$A$2:$B$164,2,0)),"",VLOOKUP(A2,SystemCodes!$A$2:$B$164,2,0))
Thanks in advance!
I am needing a fix for a cell returning a value of '0' when pulling data from a closed workbook. I have two workbooks, one houses all my data that practically remains closed, the other is the active workbook used by my team which pulls data from the closed workbook:
I have the active workbook pulling data from the closed workbook via the following code:
Option Explicit
Sub GetData_SystemCodes()
GetData ThisWorkbook.Path & "\Test_Test_v1.xlsm", "Codes", _
"A2:E163", Sheets("Codes").Range("A3"), True, True
End Sub
The problem I am having is when running this macro and pulling the data from the closed workbook to the active workbook, for example if cells E140:E150 are blank on the closed wookbook, they are returning a value of ;0' on the active workbook.
I have tried Conditional Formatting, I have tried formatting the cells with '0;-0;;@' and still nothing works. Also on the cells that are returning with a 0 value, I get an error of "The number in this cell is formated as text or preceded by an apostrophe".
I am not sure what exactly is causing this error or how to return a blank cell when the cell on the closed workbook is blank. If it helps i am using the following code on the closed workbook in the cell the data is being pulled from:
Code:
=IF(ISERROR(VLOOKUP(A2,SystemCodes!$A$2:$B$164,2,0)),"",VLOOKUP(A2,SystemCodes!$A$2:$B$164,2,0))
Thanks in advance!