Highlight columns to end of data macro

KEdwards

New Member
Joined
Oct 6, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I need a macro code that will:

1 - Highlight merged field at A3 to D3
2 - Find end of data in column H and then move down 1 rows and right 2 columns to highlight (Blue) J4 and K4 down the column to the end of that data at the left. Example: Highlight J4 & K4 down to J52 and K52 if that is where the end of data stops in H51.
3 - Then move down 2 more rows and back to I? and highlight (yellow) I, J and K.

Example Excel Highlighting Example.jpg
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi and welcome to MrExcel.

Try this:

VBA Code:
Sub Macro7()
  Dim lr As Long
  lr = Range("H" & Rows.Count).End(3).Row + 1
  Range("A3:D3, J4:K" & lr).Interior.Color = 16751001
  Range("I" & lr + 2 & ":K" & lr + 2).Interior.Color = 65535
End Sub
 
Upvote 0
Solution
Sub Macro7() Dim lr As Long lr = Range("H" & Rows.Count).End(3).Row + 1 Range("A3:D3, J4:K" & lr).Interior.Color = 16751001 Range("I" & lr + 2 & ":K" & lr + 2).Interior.Color = 65535 End Sub
Thank you sooooo much. Works perfectly!
 
Upvote 0
Hi KEdwards, You marked your answer as a solution. You must mark the answer that solves your question. Unless your own answer is the solution.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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