I am trying to format different spreadsheets. I need the data to be in the same cells for each worksheet. This data is in column A. I need to check to see if DBCS# ( ) is above Tour, and if so insert rows until Tour is in row 175, column A. The problem is that the number after DBCS# is never the same. How can I use an IF statement to make sure that the cell above Tour says DBCS# (whatever the number is) This is the If statement that I tried. If I put DBCS#46 in my IF statement, it will not work because the number after # isn't always 46.
If (Range("A174:A174") = "DBCS#") And (Range("A175:A175") = "TOUR") Then
GoTo label_177:
Else:
Do While (Range("A174:A174") <> "DBCS#") And (Range("A175:A175") <> "TOUR")
Selection.EntireRow.Insert
Loop
End If

Help with Excel VBA Code
AaronL
Sorry, but I did not realise that you have had your problem solved.
This is a good reason to mark a post as answered
Chas
dav3333333
donbox5
Try
If (Left(Range("A174:A174") ,5)= "DBCS#") And (Range("A175:A175") = "TOUR") Then
GoTo label_177:
....
R Raghu
Which rows would you like the occurences of "TOUR" to be
Chas
Steveinbeloit
Try Left(Cstr(Range...),5)
Also, is there a blank space between DBCS and # then you have to use left(string, 6).
Trisk2
Raoul_BennetH
Cause i think the code after else is not the right one.
venp
RhysDavies