LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default IF Clause


Hi,

My code looks into a folder with several xls files and opens each one
of them.
Then it copies a specific range out of a sheet and gatheres it into a
new sheet.

Unfortunately the range changes between the xls files.

It would be necessary to look out for the common header string 'Primary
Sequences', and then select the range (cols B to M) below this, until
the next header 'Derived Sequences' occurs.

If someone knows how to add such a condition to my code, this would be
very helpful!

I have enclosed example files.



Code:
--------------------

Sub Test_dateiensuchen_und_daten_extrahieren()

Dim fs As Variant, i As Integer, bla
Dim strRange As String, colcount As Integer, colcount2 As Integer
Set fs = Application.FileSearch

colcount = 2
colcount2 = 5

strRange = "B" & colcount & ":M5"

With fs
.LookIn = "M:\Development\GeneSheets_DataExtract_Loop\Gene.F ile.Lists"
.SearchSubFolders = True 'Unterordner auch durchsuchen
.Filename = "*.xls" 'alle Excel-Dateien
.Execute

For i = 1 To .FoundFiles.count - 1

Workbooks.Open .FoundFiles(i), UpdateLinks:=False 'disable message boxes
bla = ActiveWorkbook.Worksheets("Sequence Data").Range("B6:M9")
ActiveWorkbook.Close savechanges:=False

Range(strRange) = bla
colcount = colcount + 4
colcount2 = colcount2 + 4
strRange = "B" & colcount & ":M" & colcount2
'Range("B2:M5").Formula = bla
Next i

End With


Set fs = Nothing
End Sub

--------------------


Cheers,
Jurgen


+-------------------------------------------------------------------+
|Filename: GeneSheets_DataExtract_Loop.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4197 |
+-------------------------------------------------------------------+

--
juergenkemeter
------------------------------------------------------------------------
juergenkemeter's Profile: http://www.excelforum.com/member.php...o&userid=25248
View this thread: http://www.excelforum.com/showthread...hreadid=499619

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PERCENTILE with an IF Clause Zeelotes Excel Worksheet Functions 3 April 19th 23 02:11 PM
IF Clause dpal Excel Worksheet Functions 8 July 19th 07 07:32 PM
"Between" in an IF clause gavin Excel Discussion (Misc queries) 5 May 2nd 05 09:27 PM
if then clause in a cell mikewild2000 Excel Programming 3 January 29th 04 04:35 PM
Where Clause Errors Pete T[_2_] Excel Programming 0 October 20th 03 04:11 PM


All times are GMT +1. The time now is 01:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"