Hidden sheet

topi1

Board Regular
Joined
Aug 6, 2014
Messages
161
Office Version
  1. 2010
Hi,
First of all, thanks to all who offer their valuable time and help. Much appreciated. I use the following code in my workbook from the "Home" sheet. I keep the sheets "123" and "Report-start" unhidden in order for macro to work. Is there a way to modify the following macro such that I can keep "123" and "Report-start" hidden? Please note that I password protect the entire workbook.
Many thanks.

Sub Finishall()
'
' Finishall Macro
'


'
Sheets("Report-start").Select


Columns("X:Z").Select
Selection.Copy


Sheets("123").Select
Columns("X:Z").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("123").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("123").Sort.SortFields.Add Key:=Range("Y1:Y82"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("123").Sort.SortFields.Add Key:=Range("Z1:Z82"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("123").Sort
.SetRange Range("X1:Z100")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Columns("X:X").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With ActiveSheet.Cells
.ClearFormats
.Font.Name = Application.StandardFont
.Font.Size = Application.StandardFontSize




End With
Columns("Y").Replace 2, "#N/A", xlWhole
Intersect(Columns("X"), Columns("Y").SpecialCells(xlConstants, xlErrors).EntireRow).ClearContents
Columns("Y").Replace "#N/A", 2, xlWhole


LastRow = Cells(Rows.Count, "x").End(xlUp).Row
Range("x1:x" & LastRow).Copy


Sheets("Report-start").Select
Range("A1").Select
Sheets("123").Select
Range("A1").Select
Sheets("Home").Select
Range("O4").Select
End Sub
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I tried by adding the following at the start and end of the existing sub respectively but it did not work.

Sheets("report-start").Select
ActiveSheet.Unprotect Password:="password"
Sheets("123").Select
ActiveSheet.Unprotect Password:="password"

______________

Sheets("report-start").Select
ActiveSheet.protect Password:="password"
Sheets("123").Select
ActiveSheet.protect Password:="password"
 
Upvote 0
how about

Code:
Sheets("report-start").visible =True
then you can select the report-start sheet..

****do your thing here ****
sheets("report-start").Visible = False

?
 
Last edited:
Upvote 0
Why the reference to "sheet3"? The workbook does not have "sheet3".
 
Upvote 0
I tried by adding the following at the start and end of the existing sub respectively but it did not work.
Code:
Application.screenupdating=False

 Sheets("report-start").Visible = True
Sheets("report-start").select
    ActiveSheet.Unprotect Password:="password"
    Sheets("123").Select
    ActiveSheet.Unprotect Password:="password"

DO YOUR MACROSTUFF HERE =)

WHEN YOU ARE DONE....

Sheets("report-start").Visible = False

Application.screenupdating=True
 
Last edited:
Upvote 0
Arithos,
Your suggestion does not work unless I keep my workbook unprotected. Any modification?
Thanks.
 
Upvote 0
Arithos,
Your suggestion does not work unless I keep my workbook unprotected. Any modification?
Thanks.

Make it so that your workbook needs a password to enter, and when you are "IN" you can do whatever you want? I'm not that good with protecting workbooks. Though google should give you the answer quite quickly. :)
 
Upvote 0
Instead of working toward hiding unhiding etc, is there a way to Keep "report-start" and "123" unhiden but password protected, and then to use some form of user interface protection?
Thanks.
 
Upvote 0

Forum statistics

Threads
1,213,550
Messages
6,114,265
Members
448,558
Latest member
aivin

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