ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   VBA Question (Again) (https://www.excelbanter.com/excel-worksheet-functions/270854-vba-question-again.html)

carl

VBA Question (Again)
 
I was having trouble adding to my previous post so trying to start a
"new" one. The previous post is titled "VBA Question".

I am running Excel 2003.

My task is to extract the 5th row of data from a list of workbooks. I
have the list of workbooks in A1:A223. It looks like this:

J:\Projects\ORF\Meeds\xlsx\001\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\002\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\003\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\004\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\005\ORF.xlsx

Note these are xlsx files - if that matters. Also note that it is
possible for one of these files to not exist.

I am looking for a way to extract the 5th row of data (A5:H5) from
these files.

In the previous post, a recomendation was to try this:

Sub test2()
Dim nRow As Integer, nColumn As Integer, n As Integer
Dim sDir As String
nRow = 5
For i = 1 To 1
sDir = Range("A" & i) 'Range("A1:Ax") contains values like "c:\temp
\"
n = n + 1
For nColumn = 1 To 256
Sheets(2).Cells(n, nColumn) = ExecuteExcel4Macro _
("'" & sDir & "[MyFile.xls]ORF_Charge'!R" & nRow & "C" & nColumn
& "")
Next
Next
End Sub

When I run this, I get prompted by an "explorer" type window named
"MyFile" that looks like it needs me to select a file. I am not sure
what to do at that point.

Thank you in advance.

Regards.




Gord Dibben[_2_]

VBA Question (Again)
 
You won't get any more help by starting a new thread.

Keep looking at the original thread for updates so's you can see how to resolve
your issues.

You will see why you get the "MyFiles" window.


Gord

On Tue, 28 Jun 2011 05:51:28 -0700 (PDT), carl wrote:

I was having trouble adding to my previous post so trying to start a
"new" one. The previous post is titled "VBA Question".

I am running Excel 2003.

My task is to extract the 5th row of data from a list of workbooks. I
have the list of workbooks in A1:A223. It looks like this:

J:\Projects\ORF\Meeds\xlsx\001\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\002\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\003\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\004\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\005\ORF.xlsx

Note these are xlsx files - if that matters. Also note that it is
possible for one of these files to not exist.

I am looking for a way to extract the 5th row of data (A5:H5) from
these files.

In the previous post, a recomendation was to try this:

Sub test2()
Dim nRow As Integer, nColumn As Integer, n As Integer
Dim sDir As String
nRow = 5
For i = 1 To 1
sDir = Range("A" & i) 'Range("A1:Ax") contains values like "c:\temp
\"
n = n + 1
For nColumn = 1 To 256
Sheets(2).Cells(n, nColumn) = ExecuteExcel4Macro _
("'" & sDir & "[MyFile.xls]ORF_Charge'!R" & nRow & "C" & nColumn
& "")
Next
Next
End Sub

When I run this, I get prompted by an "explorer" type window named
"MyFile" that looks like it needs me to select a file. I am not sure
what to do at that point.

Thank you in advance.

Regards.



carl

VBA Question (Again)
 
On Jun 28, 2:20*pm, Gord Dibben wrote:
You won't get any more help by starting a new thread.

Keep looking at the original thread for updates so's you can see how to resolve
your issues.

You will see why you get the "MyFiles" window.

Gord



On Tue, 28 Jun 2011 05:51:28 -0700 (PDT), carl wrote:
I was having trouble adding to my previous post so trying to start a
"new" one. The previous post is titled "VBA Question".


I am running Excel 2003.


My task is to extract the 5th row of data from a list *of workbooks. I
have the list of workbooks in A1:A223. It looks like this:


J:\Projects\ORF\Meeds\xlsx\001\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\002\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\003\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\004\ORF.xlsx
J:\Projects\ORF\Meeds\xlsx\005\ORF.xlsx


Note these are xlsx files - if that matters. Also note that it is
possible for one of these files to not exist.


I am looking for a way to extract the 5th row of data (A5:H5) from
these files.


In the previous post, a recomendation was to try this:


Sub test2()
Dim nRow As Integer, nColumn As Integer, n As Integer
Dim sDir As String
nRow = 5
For i = 1 To 1
* sDir = Range("A" & i) 'Range("A1:Ax") contains values like "c:\temp
\"
* n = n + 1
* For nColumn = 1 To 256
* * Sheets(2).Cells(n, nColumn) = ExecuteExcel4Macro _
* * ("'" & sDir & "[MyFile.xls]ORF_Charge'!R" & nRow & "C" & nColumn
& "")
* Next
Next
End Sub


When I run this, I get prompted by an "explorer" type window named
"MyFile" that looks like it needs me to select a file. I am not sure
what to do at that point.


Thank you in advance.


Regards.- Hide quoted text -


- Show quoted text -


There was a problem with the site. My replies to posts were not being
displayed. Sorry about that


All times are GMT +1. The time now is 06:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com