VBA - How to create Macro that bolds a certain area based off user input

Babyfacebr3

New Member
Joined
Sep 2, 2015
Messages
1
Hi,

I am trying to create a MACRO that based off two different times that the user inputs into a message box will automatically create a thick bold border. For example:

LineTimeNameAgeDestination
19:15Chris21NV
210:15Janet22NY
311:15Lura34CA
412:15Matt52CO
513:15Ben65LI
614:15Gary76PA
715:15Jessica97US
816:15Miranda23FL
917:15Scotty65MN
1018:15Remy56MO
1119:15Poland90CT

<tbody>
</tbody><colgroup><col><col><col><col><col></colgroup>

With the information above, I would like the items in red to have a border around it based of the user inputs of 10:15-14:15. I want the times from 10:15-Age 22-Age 76 -14:15 to have a thick box border around it. I am not very good at Vba but what I have so far is the following: ( I am probably way off, but here is my attempt)

Sub attempt()

Dim a As Range, cell As Range
a = Application.InputBox("Select a range1", "Get Range", Type:=8)


Dim b As Range, cell As Range
b = Application.InputBox("Select a range", "Get Range", Type:=8)

Range("a:Q34").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone



End Sub


Any help would be greatly appreciated.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,214,553
Messages
6,120,176
Members
448,948
Latest member
spamiki

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