View Single Post
  #10   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

Hi,
- I can't see highlighting. Your thread is transfered to the Microsoft
Office Excel users group and formatting is lost. BUT, I see that I made an
error in using 0 to 1000. It should be 1 to 1000 as there is NO row 0. Sorry
:O.

- Using Row/Column format, if i = 10, then "R" & i means ROW 10 on the
worksheet.
C stands for column #, so C2 is column B, C3 is column C, C4 is column D, etc.

- So, "C1:C16" doesn't work because strValue is looking for a single value
and can't handle 16 values at once.

- BUT, you can use a 2nd For...Next statement to get multiple contiguous
column values.

Try this...
Watch the wrapping!

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

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
ACTIVECELL.OFFSET(i,icol).VALUE = EXECUTEEXCEL4MACRO(STRVALUE)
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:


Thanks again for your help, I think this is starting to make a little
more sense. What if the values I want to transfer are from column A
through column P, and rows 1 through the 1001 indicated in the code
sample? I tried the following modified code, and got an error with the
highlighted line:

Sub GetData()
Dim i As Long
Dim strValue As String

For i = 0 To 1000
strValue = "'G:\Pharmacy\Prior Auth Docs and Data\Revised Pharmacy
Denial Processes\[PAData.xls]Sheet1'!R" & i & "C1:C16"
ACTIVECELL.OFFSET(I, 0).VALUE =
EXECUTEEXCEL4MACRO(STRVALUE)
Next i
End Sub


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