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:
[TABLE="width: 540"]
<tbody>[TR]
[TD]Line[/TD]
[TD]Time[/TD]
[TD]Name[/TD]
[TD]Age[/TD]
[TD]Destination[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]9:15[/TD]
[TD]Chris[/TD]
[TD]21[/TD]
[TD]NV[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]10:15[/TD]
[TD]Janet[/TD]
[TD]22[/TD]
[TD]NY[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]11:15[/TD]
[TD]Lura[/TD]
[TD]34[/TD]
[TD]CA[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]12:15[/TD]
[TD]Matt[/TD]
[TD]52[/TD]
[TD]CO[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]13:15[/TD]
[TD]Ben[/TD]
[TD]65[/TD]
[TD]LI[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]14:15[/TD]
[TD]Gary[/TD]
[TD]76[/TD]
[TD]PA[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]15:15[/TD]
[TD]Jessica[/TD]
[TD]97[/TD]
[TD]US[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]16:15[/TD]
[TD]Miranda[/TD]
[TD]23[/TD]
[TD]FL[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]17:15[/TD]
[TD]Scotty[/TD]
[TD]65[/TD]
[TD]MN[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]18:15[/TD]
[TD]Remy[/TD]
[TD]56[/TD]
[TD]MO[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]19:15[/TD]
[TD]Poland[/TD]
[TD]90[/TD]
[TD]CT[/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col></colgroup>[/TABLE]
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.
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:
[TABLE="width: 540"]
<tbody>[TR]
[TD]Line[/TD]
[TD]Time[/TD]
[TD]Name[/TD]
[TD]Age[/TD]
[TD]Destination[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]9:15[/TD]
[TD]Chris[/TD]
[TD]21[/TD]
[TD]NV[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]10:15[/TD]
[TD]Janet[/TD]
[TD]22[/TD]
[TD]NY[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]11:15[/TD]
[TD]Lura[/TD]
[TD]34[/TD]
[TD]CA[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]12:15[/TD]
[TD]Matt[/TD]
[TD]52[/TD]
[TD]CO[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]13:15[/TD]
[TD]Ben[/TD]
[TD]65[/TD]
[TD]LI[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]14:15[/TD]
[TD]Gary[/TD]
[TD]76[/TD]
[TD]PA[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]15:15[/TD]
[TD]Jessica[/TD]
[TD]97[/TD]
[TD]US[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]16:15[/TD]
[TD]Miranda[/TD]
[TD]23[/TD]
[TD]FL[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]17:15[/TD]
[TD]Scotty[/TD]
[TD]65[/TD]
[TD]MN[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]18:15[/TD]
[TD]Remy[/TD]
[TD]56[/TD]
[TD]MO[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]19:15[/TD]
[TD]Poland[/TD]
[TD]90[/TD]
[TD]CT[/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col></colgroup>[/TABLE]
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.