I want to hide Columns from the last used cell in Row NO. 10 till the end column.

Harshil Mehta

Board Regular
Joined
May 14, 2020
Messages
85
Office Version
  1. 2013
Platform
  1. Windows
I want to hide Columns from the last used cell in Row NO. 10 till the end column.



VBA Code:
Sub Hide_Column_Rows()

Dim LastRow, LastColumn As Long

LastColumn = Cells("10", Columns.Count).End(xlToLeft).Column
Range(LastColumn + 2 & ":XFD1048576").EntireColumn.Hidden = True

LastRow = Cells(Rows.Count, "B").End(xlUp).Row
Range("B" & LastRow + 2 & ":B1048576").EntireRow.Hidden = True


End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
VBA Code:
With Range("10:10")
    Range(.Cells(1, .Columns.Count), .Cells(1, .Columns.Count).End(xlToLeft).Offset(0,1)).EntireColumn.Hidden = True
End With
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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