Find a value within a range and then hide that column?

danbates

Active Member
Joined
Oct 8, 2017
Messages
377
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Please can someone help me?

I am trying to put together a monthly check sheet for work.

It's a big ask but what I would like is a code that once the monthly check is completed it then hides that column until we get the the following month and then it does it again and so on.

There will only be 1 cell within each range with a value and the value will be a number but could be any number within reason.

The ranges are:
Jan = G7:G68.
Feb = G69:G124
Mar = G125:G186
Apr = G187:G246
May = G247:G308
June = G309:G368
July = G369:G430
Aug = G431:G492
Sept = G493:G552
Oct = G553:G614
Nov = G615:G674
Dec = G675:G736

Any help would be appreciated.

Thanks

Dan
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
You said:
it then hides that column

It looks like to me with these ranges. You would want to hide rows not columns
And how do you want to activate the script.
 
Upvote 0
Hi,

Thanks for your reply.

It is the columns I want hiding because the sheet works downwards with each day. I want to try and keep the daily checks on the same sheet as the monthly checks if it is possible but once they are completed and hidden then they are out the way of the daily checks for the rest of that month.

This is what I have in the columns:
In column A is the dates of the whole year.
In column B is the day and night shifts of the year.
Columns C:F are daily checks.
Columns G:L are monthly checks.
Columns M:Z are daily checks.
Columns AA:AE are monthly checks.

This project is in early stages so the columns can change for easier coding.

I only stated column G to start within because I was just going to alter the G for the other columns.

I was going to use the workbook open event to trigger the code.

Thanks again

Dan
 
Upvote 0
So when you open the workbook today. What do you want to happen?
A workbook open event script will run every time the workbook is opened.
You said you had every day of year in column A So if today is 12/2/2019 what should happen when the workbook is opened?
 
Upvote 0
Hi,

I've already got my codes that find today's date and then another code that finds either day shift or nights shift depending on the time.

So if I was opening the file now (day shift) and none of the daily checks for the 02/12/2019 or monthly checks for December have been done then I would want all the columns to show.

Example:
If monthly checks G and H were completed yesterday and then I opened the file today, I would like all columns to show apart from columns G and H.

The reason I said about using the workbook open event is because I'm not sure how else to work the code on a daily basis and get the columns to show again when it's a new month.

Thanks Dan
 
Upvote 0
I do not understand this:
I would like all columns to show apart from columns G and H.

show apart??
Do you mean you want all columns except for G and H

And I assume you know you cannot hide or show a part of a column.
Either the entire column is hidden or the entire column is shown.

Just like you can hide or show a entire row. But you cannot hide part of a row.
 
Upvote 0
Hi,

Yes sorry, I meant I want all columns to show except for G and H.

I do understand the whole column will be hidden for the remainder of that month, which is fine.

Thanks again

Dan
 
Upvote 0
You said:
if I was opening the file now (day shift) and none of the daily checks for the 02/12/2019 or monthly checks for December have been done then I would want all the columns to show.

How do you indicate on the sheet if the task has been done??

It's hard to help when you say you already know how to do certain things but do not explain what.

I like doing the whole script myself not just doing certain portions.

See to help we need specific details. Like what do you enter in a cell to tell xl the job is completed
 
Upvote 0
Can I send you my file somehow, then you can see what I've done so far and also I can hopefully explain it better on the actual worksheet?
 
Upvote 0

Forum statistics

Threads
1,214,396
Messages
6,119,268
Members
448,881
Latest member
Faxgirl

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