Thread: help - urgent
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
vezerid
 
Posts: n/a
Default help - urgent

OK, I am running out of inspiration for a formula-based solution (at
least one that will use only one column). Instead you can use the
following VBA macro, which will transfer the data from file B to your
target sheet. This macro should be installed in File A and it requires
that File B is open when it runs:

Sub TransferData()
outrow = 2
For inrow = 1 To 10000
If (Workbooks("File B.xls").Sheets("Sheet1").Cells(inrow, "A") <
"") Then
Cells(outrow, "B") = Cells(inrow, "A")
outrow = outrow + 2
End If
Next inrow
End Sub

What to modify:
-the number 10000 should be changed to the highest number row expected
to contain data in File B
-change the text constants inside the quotes ("File B.xls", "Sheet1")
to the names of the input workbook and sheet respectively.
-Cells(inrow,"A") supposes the data in the input file are in column
"A". Modify to suit. Same for Cells(outrow,"B") for the output file.

How to install:
Alt+F11 to go to the VBA editor.
Menu Insert|Module
Paste the above code after modifications.

To run:
Go to the sheet where you want the data transferred.
Alt+F8 to show the macros dialog box
Select the macro TransferData and Run.

Once the data are imported in column B:B you can use the remainder of
my first post. In column C:C:

=IF(A1<"",A1,B1)

Does this help?

Kostis Vezerides