You are on page 1of 4

9/23/2020 Show gridlines in a worksheet using Excel and VBA | Exceldome

(https://www.exceldome.com/)

Home (https://www.exceldome.com/ ) Tutorials (https://www.exceldome.com/solutions/ )


Real-World Examples (https://www.exceldome.com/real-world-examples/ )

Show gridlines in a worksheet


How to show gridlines in a worksheet using Excel and VBA methods

EXCEL VBA EXPLANATION

METHOD 1. Show gridlines in a worksheet using a ribbon option EXCEL

Select worksheet > View tab > Show group > Check Gridlines checkbox

1. Select the worksheet in which to show


the gridlines.
Note: in this example we are showing
the gridlines in Sheet 2.

2. Select the View tab.

3. Click on the Gridlines checkbox, in the


Show group, to select the checkbox.

METHOD 2. Show gridlines in a worksheet using a ribbon option EXCEL

Select worksheet > Page Layout tab > Sheet Options group > Gridlines > Check View checkbox

https://www.exceldome.com/solutions/show-gridlines-in-a-worksheet/ 1/4
9/23/2020 Show gridlines in a worksheet using Excel and VBA | Exceldome

1. Select the worksheet in which to show


the gridlines.
Note: in this example we are showing
the gridlines in Sheet 2.

2. Select the Page Layout tab.

3. Check the View checkbox under the


Gridlines title, in the Sheet Options
group.

METHOD 1. Show gridlines in a worksheet using VBA VBA

EDIT VBA PARAMETERS (https://www.exceldome.com/solutions/show-gridlines-in-a-worksheet-vba-method-1-


pe/) 
Sub Show_Gridlines()

'show gridlines in an active worksheet


ActiveWindow.DisplayGridlines = True

End Sub

METHOD 2. Show gridlines in a speci c worksheet using VBA VBA

EDIT VBA PARAMETERS (https://www.exceldome.com/solutions/show-gridlines-in-a-worksheet-vba-method-2-


pe/) 
Sub Show_Gridlines()

Dim ws1 As Worksheet

Set ws1 = Worksheets("Sheet2")



https://www.exceldome.com/solutions/show-gridlines-in-a-worksheet/ 2/4
9/23/2020 Show gridlines in a worksheet using Excel and VBA | Exceldome

'show gridlines in a worksheet named Sheet2


ws1.Activate
ActiveWindow.DisplayGridlines = True

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.

PREREQUISITES
Worksheet Names: Have a worksheet named Sheet2.

ADJUSTABLE PARAMETERS
Sheet Selection: Select the worksheet in which you want to show the gridlines by changing the Sheet2 worksheet name in
the VBA code.

Explanation about how to show gridlines in a worksheet EXPLANATION

EXPLANATION
This tutorial explains and provides step by step instructions on how to show gridlines in a single worksheet using Excel
and VBA methods.
Excel Methods: This tutorial provides two Excel methods that can be applied to show gridlines in a single worksheet. Both
of the methods are very similar to each other, with one using the View tab and the other using the Page Layout tab. Using
either of the two methods you can show gridlines, in a single worksheet, in three steps.
VBA Method: Using VBA the gridlines can be shown in an active or a speci c worksheet by setting the
ActiveWindow.DisplayGridlines to True.

RELATED TOPICS

Hide gridlines in a worksheet


(https://www.exceldome.com/solutions/hide- How to hide gridlines in a worksheet using Excel and VBA methods
gridlines-in-a-worksheet /)

Hide gridlines in multiple worksheets


(https://www.exceldome.com/solutions/hide- How to hide gridlines in multiple worksheets using Excel and VBA methods
gridlines-in-multiple-worksheets/)

Show gridlines in multiple worksheets


(https://www.exceldome.com/solutions/show- How to show gridlines in multiple worksheets using Excel and VBA methods
gridlines-in-multiple-worksheets/)

Hide gridlines in a workbook


(https://www.exceldome.com/solutions/hide- How to hide gridlines in a workbook using Excel and VBA methods

gridlines-in-a-workbook/)

https://www.exceldome.com/solutions/show-gridlines-in-a-worksheet/ 3/4
9/23/2020 Show gridlines in a worksheet using Excel and VBA | Exceldome

Show gridlines in a workbook


(https://www.exceldome.com/solutions/show- How to show gridlines in a workbook using Excel and VBA methods
gridlines-in-a-workbook/)


(
h
tt
p
s
:/
/
w
w
w
.f
a
c
e
b
o
o
k
.
c
o
m
/
e
x
c
e
l
d
o
m
e
1
/)

Home (https://www.exceldome.com) | Tutorials (https://www.exceldome.com/solutions/) | Real-World Examples (https://www.exceldome.com/real-

world-examples/) | About Us (https://www.exceldome.com/about-us/) | Contact Us (https://www.exceldome.com/contact-us/) | Terms and

Conditions (https://www.exceldome.com/terms-and-conditions/) Copyright © 2018-2020 Exceldome. - All Rights Reserved


https://www.exceldome.com/solutions/show-gridlines-in-a-worksheet/ 4/4

You might also like