Hiding & Unhiding Columns & Rows

  • Thread starter Thread starter windme
  • Start date Start date
W

windme

Hello,
I have a macro that does the following:
Unhides any column from "C" to "AJ"
Unhides any row from "4 to 34"
Looks for the first blank cell in "column C" starting at "C4" an
places the cursor there for data input.

This is the macro:

Sub unhideeverything()
ActiveWindow.DisplayHeadings = False
Columns("C:AJ").Select
Selection.EntireColumn.Hidden = False
Rows("4:34").Select
Selection.EntireRow.Hidden = False
Range("C4").Select
Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas
LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext
MatchCase:= _
False, SearchFormat:=False).Activate
End Sub

Here's where I need help. After entering data in the first blank ro
after "C4" I would like to do the following:
Hide columns F, X, Y, Z
Go to the first blank cell in column "C" after C4 and hide that row an
subsequent rows to row 34.
Thank you in advance for any suggestions.

Mik
 
Mike,

Using the same code as you already have, try this

Sub unhideeverything()
ActiveWindow.DisplayHeadings = False
Columns("C:AJ").EntireColumn.Hidden = False
Rows("4:34").EntireRow.Hidden = False
Range("C4").Select
Cells.Find(What:="", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False).Activate
ActiveCell.Value = InputBox(prompt:="Enter a value")
Columns("C:AJ").EntireColumn.Hidden = True
Range("C4").Select
Cells.Find(What:="", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False).Activate
Rows(ActiveCell.Row & ":34").EntireRow.Hidden = True
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top