Find the last row and highlight it yellow

tropics123

Board Regular
Joined
May 11, 2016
Messages
85
Hi, any help on this is greatly appreciated!

I'm trying to find the last row with data and highlight it yellow. I started with finding the last row but don't know the rest :) Help!

Sub HighlightLastRow()


Dim LastRow As Long

With Sheets("Sheet1")
LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi, I tried that and it only highlighted the last cell in column A. I was hoping it would highlight the entire row. Or maybe a better way is, find data in the last row in column A and highlight the entire row?
 
Upvote 0
How about
Code:
With Sheets("Sheet1")
   Lastrow = .Cells(.Rows.Count, 1).End(xlUp).Row
   .Rows(Lastrow).Interior.Color = 45678
End With
Or
Code:
Range("A" & Rows.Count).End(xlUp).EntireRow.Interior.Color = 45678
 
Last edited:
Upvote 0
How about

Code:
Cells(Rows.Count, 1).End(xlUp).Interior.ColorIndex = 27
Hi, I tried that and it only highlighted the last cell in column A. I was hoping it would highlight the entire row. Or maybe a better way is, find data in the last row in column A and highlight the entire row?
How about modifying Bill's code line to this...
Code:
Cells(Rows.Count, 1).End(xlUp)[B][COLOR="#FF0000"].EntireRow[/COLOR][/B].Interior.ColorIndex = 27
 
Upvote 0
How many Rows of data do you have?

You can add .resize(, 5) preceding the Interior.ColorIndex = 27

Change the "5" for the amount if columns in your data.
 
Upvote 0
I used Rick's modified version of Bill's and it worked!! Thank you!
Cells(Rows.Count, 1).End(xlUp).EntireRow.Interior.ColorIndex = 27!

Not sure if I could ask more questions in the same thread or but here goes...
Above the yellow highlighted row are many columns filled with data, and a lot of the columns have repeated headers. For example, there will be multiple columns with the header "Type" and "Credit". I need some more help with #2 &#3 below :) I greatly appreciate your help.

1) Copy all data from columns A-L and paste it in the first empty cell in column A below the highlighted row. This one I can do the macro for.

2) If header is "Type" (and may appear in multiple columns), put in word "Finance" in the same column directly below the yellow highlighted row and go all the down to match with the number of rows in column A (the word "Finance" can only start below the yellow row)

3) Copy all amounts in columns with header "Credit" and change the amounts to a positive number. The header "Credit" might be in multiple columns but find them all, and paste it directly its respective column below the yellow highlighted row.
 
Last edited:
Upvote 0
As this is now a completely different you will need to start a new thread.
Thanks
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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