I have data currently in an Excel spreadsheet in Columns C:Q
Columns are going to be added but Column C will always be the starting point with C6 being the first data cell. Row 5 has headings and no cell in the data area in row 5 is blank.
Row 6 has data but there are cells which are blank.
I would like to select data from C6 to the last row in the next to last column. (Currently I would like to select C:P as P is the second last column)
I have a tag column 6 columns to the right of P that has various codes. IF there is an X, I would like to highlight the entire row.
I hope that this is not too complicated a question and someone can help. I am at sixes and sevens on how to select the data that I require and then highlight the row that corresponds to the cell that is coded X. Thank you.
Columns are going to be added but Column C will always be the starting point with C6 being the first data cell. Row 5 has headings and no cell in the data area in row 5 is blank.
Row 6 has data but there are cells which are blank.
I would like to select data from C6 to the last row in the next to last column. (Currently I would like to select C:P as P is the second last column)
I have a tag column 6 columns to the right of P that has various codes. IF there is an X, I would like to highlight the entire row.
VBA Code:
'If Close = Y , then shade row from C:T (T=Sen All Funds)
Dim LastRow As Integer
'Identify Data Rows
LastRow = Range("A" & Rows.Count).End(xlUp).Row
'Select data from A4 to last data row in T (U= Row#)
Range("C4:P" & LastRow).Select 'I WOULD LIKE TO SELECT THIS RANGE WIHTOUT USING P
'Conditional format -- shade A:K blue if two conditions are met
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=rc[6]=""X""" 'IF THERE IS AN X SIX COLS TO THE RIGHT OF THE LAST COLUMN SELECTED, THE ROW SHOULD BE HIGHLIGHTED
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 14539203 'grayish blue
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("K6").Select
I hope that this is not too complicated a question and someone can help. I am at sixes and sevens on how to select the data that I require and then highlight the row that corresponds to the cell that is coded X. Thank you.