Formatting Border Only If Text Is Entered

CraigWolfenden

New Member
Joined
Sep 9, 2010
Messages
39
Hello There,

I am currently trying to create a spreadsheet, it contains several sheets. I have written a formula so when you enter 1 in column A it looks up the remainder of the row from a master sheet.

My problem is depending on the month of the year depends on how many rows will be populated. Jan may have something like 4 at my site but 7 on another site.

As my formula's contain a formula to copy relevant data accross all the VB scripts I have tried simply format all the cells.

The script I am currently using is:

Sub DrawBorders()
Dim rCell As Range
Dim rRange As Range

Set rRange = Range("A1", Range("A65536").End(xlUp))

For Each rCell In rRange
If Not IsEmpty(rCell) And _
Not IsEmpty(rCell.Offset(1, 0)) Then
With rCell
If .Value <> .Offset(1, 0).Value Then
With .EntireRow.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End If
End With
End If
Next rCell

I am not very confident with VB script and this is the first I have used, although I would really like to learn the language.

Any help would be very much appreciated.

Craig.
 
Can I ask why you aren't using Conditional Formatting for this?
 
Upvote 0
Hello Glenn,

I have tried using the formula

=if(a5>,0.01,1,0)

However this does not seem to work, I am not sure if I am approaching this in the wrong direction.

I am certainly open to suggestions if you have a simpler option.

Thank you for your reply.
 
Upvote 0

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