I have the two following blocks of code to pull data from an external excel sheet:
p = "c:\Test\"
'p is the path to the document'
f = "HOST03.xls"
'f is the filename of the excel sheet'
s = "tabvInfo"
's is the sheet name'
a = "A16"
'a is the reference cell'
Application.ScreenUpdating = False
For r = 2 To 42
For c = 1 To 1
a = Cells(r, c).Address
Cells(r + 8, c + 1) = GetValue(p, f, s, a)
Application.ScreenUpdating = True
Public Function GetValue(path, file, sheet, ref)
' Retrieves a value from a closed workbook
Dim arg As String
' Make sure the file exists
If Right(path, 1) <> "\" Then path = path & "\"
If Dir(path & file) = "" Then
GetValue = "File Not Found"
' Create the argument
arg = "'" & path & "[" & file & "]" & sheet & "'!" & _
Range(ref).Range("A1").Address(, , xlR1C1)
' Execute an XLM macro
GetValue = ExecuteExcel4Macro(arg)
The problem is that for the empty cells, it puts in a o rather than leaving it blank which is my desired effect. I've tried added in a call for IsEmpty() but unfortunately I'm not able to get it to work properly due to my lack of experience with coding. Any help/advice is appreciated.