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: 11
Default InStr Function

Hello All,
Hopefully someone can help me as I have been struggling with this last bit
of code.
I am attempting to loop through an advanced filter field and on select
certain cells that meet 2 additional criteria

I have no problem doing this with one criteria but cannot figure out the
second part.

If my advanced filter comes out with the following:

S0001
S0002
S0003
ABC
123
N0001
N0002

I want to loop through this list and select only those cells that start with
an "S" or an "N"... I am doing the code in a word document referencing
Excel..what the code is supposed to do is take cell value and add .doc to
the end and then insert that file into one word document.

Here is what I have come up with so far:

For icount = 1 To 7

wording = xlObj.Worksheets("sheet1").Range("A" & icount).Value
If wording = "" Then
'do nothing

' A textual comparison starting at position
ElseIf InStr(1, wording, "s") = False Then -----this is where I need help (I
think)
'do nothing

Else
Selection.InsertBreak Type:=wdPageBreak
Selection.InsertFile FileName:=baseDir & wording, Range:="",
ConfirmConversions:= _
False, Link:=False, Attachment:=False
End If

If icount = 6 Then
Exit For
End If
Next icount

Thanks so much for any comments.


 
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
Use InStr function in formula? Lee Hunter Excel Worksheet Functions 8 May 8th 23 03:45 AM
Help with VBA InStr() function EagleOne Excel Discussion (Misc queries) 10 April 12th 07 02:47 PM
InStr Function Question gfh28105 Excel Programming 3 September 14th 05 02:28 AM
InStr function question [email protected] Excel Programming 9 June 28th 05 03:03 PM
Instr function problem Ross Withey Excel Programming 9 November 14th 03 08:02 AM


All times are GMT +1. The time now is 06:16 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"