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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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