grid a range

Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
675
Office Version
  1. 365
Platform
  1. Windows
Good evening,

A worksheet I am working on ( only 100+ rows ATM but will grow to 8000!)

Range is a1:k8000, can someone sort some VB so when 'data' is in entered into any cell within the range it will grid the complete range & when the data is removed, grid reforms accordingly,
fomat:-
font size 14 & Calibri
bottom align
left align

some challenge guanlet ? but hoping some kind 'sir knight of code' can sort a poor user in distress!

KR
Trevor3007
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Start with this and tell me.

Put the code in the events of your sheet
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:K")) Is Nothing Then
        If Target.Count > 1000 Then Exit Sub
        For Each c In Target
            If c.Value = "" Then
                c.Borders.LineStyle = xlNone
                c.Font.Name = "Calibri"
                c.Font.Size = 14
                c.HorizontalAlignment = xlLeft
                c.VerticalAlignment = xlBottom
            Else
                c.Borders.LineStyle = xlContinuous
            End If
        Next
    End If
End Sub

SHEET EVENT
Right click the tab of the sheet you want this to work, select view code and paste the code into the window that opens up.
 
Upvote 0
Start with this and tell me.

Put the code in the events of your sheet
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:K")) Is Nothing Then
        If Target.Count > 1000 Then Exit Sub
        For Each c In Target
            If c.Value = "" Then
                c.Borders.LineStyle = xlNone
                c.Font.Name = "Calibri"
                c.Font.Size = 14
                c.HorizontalAlignment = xlLeft
                c.VerticalAlignment = xlBottom
            Else
                c.Borders.LineStyle = xlContinuous
            End If
        Next
    End If
End Sub

SHEET EVENT
Right click the tab of the sheet you want this to work, select view code and paste the code into the window that opens up.

heyhey...

was hoping u would 'popup' :]

works to a point. it should engulf the 'whole area:-

text is added into cell g50... grid should surround, a2:k50
if I add text into b345, then grid would be , a2:k345 etc...

great of you BTW :}
 
Upvote 0
heyhey...

was hoping u would 'popup' :]

works to a point. it should engulf the 'whole area:-

text is added into cell g50... grid should surround, a2:k50
if I add text into b345, then grid would be , a2:k345 etc...

great of you BTW :}

Let's try this to see what happens

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:K")) Is Nothing Then
        If Target.Count > 1000 Then Exit Sub
        For Each c In Target
            If c.Value = "" Then
                cuenta = WorksheetFunction.CountA(Range("A" & c.Row & ":K" & c.Row))
                If cuenta = 0 Then
                    With Range("A" & c.Row & ":K" & c.Row)
                        .Borders.LineStyle = xlNone
                        .Font.Name = "Calibri"
                        .Font.Size = 14
                        .HorizontalAlignment = xlLeft
                        .VerticalAlignment = xlBottom
                    End With
                End If
            Else
                Range("A2:K" & c.Row).Borders.LineStyle = xlContinuous
            End If
        Next
    End If
End Sub
 
Upvote 0
Let's try this to see what happens

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:K")) Is Nothing Then
        If Target.Count > 1000 Then Exit Sub
        For Each c In Target
            If c.Value = "" Then
                cuenta = WorksheetFunction.CountA(Range("A" & c.Row & ":K" & c.Row))
                If cuenta = 0 Then
                    With Range("A" & c.Row & ":K" & c.Row)
                        .Borders.LineStyle = xlNone
                        .Font.Name = "Calibri"
                        .Font.Size = 14
                        .HorizontalAlignment = xlLeft
                        .VerticalAlignment = xlBottom
                    End With
                End If
            Else
                Range("A2:K" & c.Row).Borders.LineStyle = xlContinuous
            End If
        Next
    End If
End Sub

hiya,

yeah that works thanks.... a tip my hat to you sir.

Have raised another ask BTW:}

MTA Trevor3007
 
Upvote 0
NP & hope you will solve my future request for 'HELP' again :}
adios :beerchug:
 
Upvote 0
Of course, if it is within my means, with pleasure.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
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