View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Gary L Brown Gary L Brown is offline
external usenet poster
 
Posts: 219
Default Get External Data VBA

1) It didn't seem to pull any actual data from the sheet, gave me the
standard REF!# in each cell
Check your path, workbook name, worksheet name and R/C syntax. The same
methodology worked for me in a sample I just tried.
REF!# usually means it can not find what it's looking for. This is why I
think something was inadvertently typed incorrectly.

2) It began to fill in column B, skipped over column A

I added a '- 1' to the Offset so that everything starts at your current
Active cell.

3) How can I get it to transfer blank cells as blank cells, not the REF!#?

I added a new variable (varValue) and an IF statement so blanks are not
included.


Sub GetData()
Dim i As Long, iCol as long
Dim strValue As String
Dim varValue As Variant

for iCol = 1 to 16 'Cols A to P
For i = 1 To 1000 'Rows 1 to 1000
strValue = "'G:\Pharmacy\Prior Auth Docs and Data\Revised Pharmacy
Denial Processes\[PAData.xls]Sheet1'!R" & i & "C" & iCol
varValue = ExecuteExcel4Macro(strValue)
If Len(varValue) < 1 And varValue < 0 Then
ActiveCell.Offset(i - 1, iCol - 1).Value = varValue
End If
Next i
next iCol

End Sub


HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"andysgirl8800" wrote:


I gave that a try, and I ran into 3 problems:
1) It didn't seem to pull any actual data from the sheet, gave me the
standard REF!# in each cell
2) It began to fill in column B, skipped over column A
3) How can I get it to transfer blank cells as blank cells, not the
REF!#?


--
andysgirl8800
------------------------------------------------------------------------
andysgirl8800's Profile:
http://www.excelforum.com/member.php...o&userid=34752
View this thread: http://www.excelforum.com/showthread...hreadid=547498