View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Paul C Paul C is offline
external usenet poster
 
Posts: 269
Default If for word in sentence

Try this (assuming A14 would not start with "Information:" when there is the
extra phrase)

If Left(Range("A14"),11)=" Information" Then
Do Something
Else
Do Something Else
End if
--
If this helps, please remember to click yes.


"Graham H" wrote:

I download various files from a site which are all the same format starting as shown
below. The first row is always blank. The column A cells below this row all have text data
which can be made up of several words making up a phrase or sentence. All wihout fail
start with the word Information. There are two types of file one which has 12 rows
starting with this word and those which have 13. Where there are 13 the extra phrase is
the one shown in A8 which is the only one phrase I have shown in its entirety. There is a
lot of data after row 14 but it is not relevant for this exercise. What I need to do in
code is tio identify whether we have a file with the 12 rows starting with information or
thirteen ie

if (rows 2 to 14 start with the word information) then
do this
else

I hope this makes sense as I would value any guidance on the best way to do this when the
word is the start of a phrase or sentence.


A1 Blank row
A2 Information: This is the Field Data etc
A3 Information: To upload this file etc
A4 Information: You MUST NOT change the etc
A5 Information: Every line of data MUST start with '' etc
A6 Information: The entries for etc
A7 Information: 'Area Eligible for LFASS 2009' is only applicable for Permanent land.
A8 Information: For non LFA land do not enter a value in the column 'Area Eligible for
LFASS 2009'.

A9 Information: Ensure that a blank line etc
A10 Information: Always use the code list etc
A11 Information: Always save this file before uploading (as a .CSV file) etc
A12 Information: You MUST start a new sheet etc
A13 Information: These details are for etc
A14 Information:
A15
A16
etc