I have this looping structure:
Code:
For iCol = 1 To iTotalCols
bFoundCellCol = False
sRange = getColumnLetter(iCol) & iRow
Range(sRange).Select
'... if the any cells are bold then remove the formatting from them
Selection.Font.Bold = False
iCurrentCellCol = Range(sRange).Interior.ColorIndex
'... if the colour of the current cell is not WHITE
If iCurrentCellCol <> gbFLUSH_COLOUR Then
For j = LBound(gaRulesColour) To UBound(gaRulesColour)
iPos = InStr(gaRulesColour(j), "/")
iArrayColour = Mid(gaRulesColour(j), iPos + 1, Len(gaRulesColour(j)) - 1)
If iCurrentCellCol = iArrayColour Then
If the_Heading <> "" Then
rulesXML = rulesXML & "<fare_rule_lines>"
rulesXML = rulesXML & "<heading>" & fix_characters(fix_ampersand(the_Heading)) & "</heading>"
rulesXML = rulesXML & "<content>" & fix_characters(Trim(the_Content)) & "</content>"
rulesXML = rulesXML & "</fare_rule_lines>"
End If
the_Heading = fix_ampersand(Trim(Range(sRange).Text))
the_Content = "<table>"
End If
iPos = InStr(gaContentColour(j), "/")
iArrayContentColour = Mid(gaContentColour(j), iPos + 1, Len(gaContentColour(j)) - 1)
'... take the start of the content and the totalrows and total columns
content_range = Left(gaContentColour(j), 2)
content_range = content_range & ":" & getColumnLetter(iTotalCols) & iTotalRows
'... delete all empty cells in the content range then
'... shift them all left
'Range(content_range).Select
'Selection.SpecialCells(xlCellTypeBlanks).Select
'Selection.Delete Shift:=xlToLeft
iCurrentCellColour = Range(sRange).Interior.ColorIndex
If iCurrentCellColour <> 2 Then
'... if the current cell is the same as the colour of the content in the template
If iCurrentCellColour = iArrayContentColour Then
iFlag = 0
While flag <> True
sRightRange = getColumnLetter(iCol + iFlag + 1) & iRow
'... if the cells are merged then split them up
With Range(sRightRange)
If .MergeCells Then
.MergeArea.UnMerge
End If
End With
'sRange = getColumnLetter(iCol + iFlag) & iRow
'... if it is not empty then write another <td>
If iFlag = 0 And Trim(Range(sRightRange).Text) <> "" Then
the_Content = the_Content & "<tr>"
the_Content = the_Content & "<td>"
the_Content = the_Content & fix_ampersand_to_amp(Trim(Range(getColumnLetter(iCol + iFlag) & iRow).Text))
the_Content = the_Content & "</td>"
ElseIf iFlag = 0 And Trim(Range(sRightRange).Text) = "" Then
the_Content = the_Content & "<tr>"
the_Content = the_Content & "<td>"
the_Content = the_Content & fix_ampersand_to_amp(Trim(Range(getColumnLetter(iCol + iFlag) & iRow).Text))
the_Content = the_Content & "</td>"
the_Content = the_Content & "</tr>"
flag = True
ElseIf iFlag <> 0 And Trim(Range(sRightRange).Text) = "" Then
the_Content = the_Content & "<td>"
the_Content = the_Content & fix_ampersand_to_amp(Trim(Range(getColumnLetter(iCol + iFlag) & iRow).Text))
the_Content = the_Content & "</td>"
the_Content = the_Content & "</tr>"
flag = True
ElseIf iFlag <> 0 And Trim(Range(sRightRange).Text) <> "" Then
the_Content = the_Content & "<td>"
the_Content = the_Content & fix_ampersand_to_amp(Trim(Range(getColumnLetter(iCol + iFlag) & iRow).Text))
the_Content = the_Content & "</td>"
'... if the cell is empty
End If
iFlag = iFlag + 1
'... while flag <> true
Wend
'... if the cell is the same as the colour in the template
End If
End If
Next j
End If
'... loop through each column
Next iCol
i am looking for code that when it finds a 'heading' in the specified range it checks one row DOWN and if it is LOWER CASE then it adds it to the heading it has found.
TIA.
Picco
Is this possible?
www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt