Avatar of Frank Freese
Frank Freese
Flag for United States of America asked on

Hiding cells

Folks,
In the attached workbook I have a sheet that when activated I am tryinh to hide a range of cells in the beginning. I'll unhide them later. But for now the range is not being hidden?
WeekEndShaded.xlsm
Microsoft Excel

Avatar of undefined
Last Comment
Frank Freese

8/22/2022 - Mon
SOLUTION
Saqib Husain

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Steven Harris

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Frank Freese

ASKER
Here's what confuses me:

http://www.ehow.com/how_5875452_use-macro-hide-section-excel.html

Is this incorrect?
Frank Freese

ASKER
here's a link that shows how to hide selected cells:

http://www.ehow.com/how_2212385_hide-cell-contents-excel.html
SOLUTION
Steven Harris

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Frank Freese

ASKER
ThinkSpaceSolutions,
I tried the first one with a macro and indeed it failed to do anything. At that point I presented the problem to EE. The second one with the three ;;; look to satisfy my objective. I tested it against various formats and it appears to work with all formats not just numbers.
I'll follow-up with additional questions as I build my total solution to my objectives. The next thing I plan to do is protect those cells that I have "hidden" (which I have code from Martin already). Afterwards, more questions.
I appreciate the additional detain you provided. Ssaqibh did offer some helpful information so in fairness I'll share the points between the two of you.
Thank you
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Frank Freese

ASKER
I've requested that this question be closed as follows:

Accepted answer: 0 points for fh_freese's comment #a39673457
Assisted answer: 167 points for ssaqibh's comment #a39673349
Assisted answer: 167 points for ThinkSpaceSolutions's comment #a39673378
Assisted answer: 166 points for ThinkSpaceSolutions's comment #a39673445

for the following reason:

Thanks to all!
Frank Freese

ASKER
RATS!
I messed up by accepting my answer. I'm going to Object to my answer and ask that I redistribute points to the two of you. Must have been a senior moment, "again".
Frank Freese

ASKER
I've requested that this question be closed as follows:

Accepted answer: 166 points for ThinkSpaceSolutions's comment #a39673445
Assisted answer: 167 points for ssaqibh's comment #a39673349
Assisted answer: 167 points for ThinkSpaceSolutions's comment #a39673378
Assisted answer: 0 points for fh_freese's comment #a39673457

for the following reason:

I'm going with the following offered solution:

ActiveSheet.Range("A2:B13").NumberFormat = ";;;"
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Steven Harris

Glad to help and we look forward to you coming back!
Frank Freese

ASKER
Did I do the correction correctly?
ASKER CERTIFIED SOLUTION
Saqib Husain

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Frank Freese

ASKER
thank you
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Frank Freese

ASKER
ThinkSpaceSolutions,
I've got a problem implementing your sugguestion:
ActiveSheet.Range("A2:B13").NumberFormat = ";;;"

Here's what I did to further test this:
ActiveSheet.Range ("A2:A7").DateFormate = ";;;" since the cells in in that range are Date formated.
I also tried used ActiveSheet.Range("A2:A7").NumberFormat = ";;;"
In either case I got the following error:
Run-time error 425:
Object required.

Now if I create a Custome format of ";;;" and apply that to any cell, regardless of the cells formating everything works fine. However my objective right now is to hide the cells contents when the sheet is activated and will "unhide" them later.

I'm using the ActiveSheet.Range ("A2:A7").DateFormate = ";;;" in the Activate worksheet procedure.

I'm only guessing here but I have no other place to place my code except ActivateWorksheet procedure. Since I am asking to change the cell format to blank I am asking it before the object has been loaded, therefor the error Object required?
Frank Freese

ASKER
Folks,
It looks like I found my problem. I changed .NumberFormat=";;;" to DateFormat=";;;" thinking that because the cells were in date format I could not use the NumberFormat, which I found to be wrong.