If for word in sentence

G

Graham H

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
 
R

Rick Rothstein

You can count how many lines begin with "Information" using this...

InfoCount = WorksheetFunction.CountIf(Range("A1:A14"), "Information*")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top