VBA loop for next

jakobt

Active Member
Joined
May 31, 2010
Messages
337
In Column B is a concequtive list of numbers from 1000000 to 7000000.

Want to insert a underline border in column A to H the first time the number is above 3999999.

(This is part of a vba formatting mode)
Column B is a list of account numbers. Not sure the specific account 3.999.999 exists.

But as said I want an underline border between < 4.000.000 and => 4.000.000
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
You could achieve this with Conditional Formatting but if you want a VBA approach, try this:

Code:
Sub Underline()
Dim lRow As Long
lRow = WorksheetFunction.Match(4000000, Range("B:B"), 1)
Range(Cells(lRow, 1), Cells(lRow, 8)).Borders(xlEdgeBottom).LineStyle = xlContinuous

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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