Highlight/identify last column containing text in each row

RichCowell

Board Regular
Joined
Dec 5, 2013
Messages
121
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm usually hopeful that things will be possible somehow when I post here, but I'm dubious about this one...

I've got a list of companies in one column, then a column for each meeting they attend, some haven't attended for ages, so I'd like to identify that somehow, like changing the font of format of the cell.

e.g.

A
B
C
D
E
1
Company
Meet 1
Meet 2
Meet 3
Meet 4
2
BBC
X
X
3
ITV
X
4
Channel 4
X
X
X
X

<tbody>
</tbody>

The whole spreadsheet is 42 columns wide so far, and will be growing gradually by at least 15 columns per year, so it's a bit of a pain to keep looking.

Thanks,
Rick
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try:
Code:
Sub HighlightCol()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim lColumn As Long
    lColumn = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
    Dim company As Range
    Cells.Interior.ColorIndex = xlNone
    For Each company In Range("A2:A" & LastRow)
        lColumn = ActiveSheet.Cells(company.Row, Columns.Count).End(xlToLeft).Column
        Cells(company.Row, lColumn).Interior.ColorIndex = 3
    Next company
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks for that - I've realised I should have mentioned the data is in a table - as I've just run that and it's just highlighted the last column of the table...

Can it still be done with the data in a table?
 
Upvote 0
Try:
Code:
Sub HighlightCol()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim lColumn As Long
    lColumn = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
    Dim company As Range
    Cells.Interior.ColorIndex = xlNone
    For Each company In Range("A2:A" & LastRow)
        lColumn = ActiveSheet.Rows(company.Row).Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
        Cells(company.Row, lColumn).Interior.ColorIndex = 3
    Next company
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,417
Messages
6,124,787
Members
449,188
Latest member
Hoffk036

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top