I need some VBA code to hide columns if they are outside of a specified date range.
- the worksheet i need to run this VBA on is named 'Summary'
- Columns A to G need to remain un-hidden at all times
- from H17 to ZZ17 i have every month of the relevant years listed (all there chronologically)
- D3 holds the 'Date From' variable
- D4 holds the 'Date To' variable
based on user date ranges entered on sheet1, I'm trying to write code that will write each month of the date range on other sheets across the 2nd row. at this point I'm getting "object required" error at "Set DateStart = Cells(2, 6)"
I also want the date format to be mmm-yy (Mar 14) on the sheets even if sheet1 has a different format. I tried using sourcerange instead of DateStart, but that didnt work either.
Code:
Dim projStartDate As Date Dim projEndDate As Date Dim DateStart As Date[code]....
I have a spreadsheet with a number of sheets two of which contain tables with many columns with a date heading, I would like a means for the user to select a range of dates and for the spreadsheet to automatically hide any columns that don't fall within this range.
I need to show hidden columns based on the date I entered. For example, if I entered "1/1/1990" on a1 as the starting date and "4/30/1990" on b1 as the ending date. I want Excel to show the columns that are covered by the date, thus it shows Jan, Feb, March and April. How do I do that? Here's an example attachment. In here Sheet 1 is the starting point, the highlighted cells is where I enter the date. the Result sheet shows what I want Excel to show me when I have a date entered.
I am building a sheet to display deadlines (rows) by project (columns). I would like to have it automatically hide the rows and columns based on the date of the deadline. If the deadline is today or 1 week from today the associated rows and columns should be visible, otherwise, I would like to hide them.
My table is A1:N9, with A1 being a blank, row names A2:A9, and column names B1:N1.
Hide Columns based on Date value in cell (Worksheet Change event)Looking for a worksheet_change event macro that will automatically hide columns based on a value in cell S3. S3 is a data validation pick list of months based on the 1st day of each (e.g. 1/1/2014, 2/1/2014, 3/1/2014, etc.). I have date columns in row 6 from columns T through AQ. These values are 1/1/2014 (T6), 2/1/2104 (U6), 3/1/2014 (V6)....12/1/2015 (AQ6). I would like to hide columns that have a date in row 6 (T6:AQ6) that is LESS THAN (<) the date in S3 after the cell is value is changed.
Sheet 1 - I have columns filled with dates (weekdays only) For example 28-May, 29-May, 30-May up to 28-Nov. Above 10 rows below each date columns and each cell has some values.
Sheet 2 - I have Start date defined in B1 Cell, and End date defined in B2 Cell
I need defining the formula to sum all the cell values fall between the date range defined in Sheet 2 B1 and B2.
For Example if B1=28-May B2=30-May, I want the sum of all the numbers come under the range of 28-May to 30-May, with this above example, it should be 19.5.
I am very new to VBA. I need to have a code that will hide/unhide cells based on a date range.
Cell A1 contains the formula for todays date, based on that answer, I want to hide/unhide columns based on a weekly date range.
Ex.:
Today is 03/18/2014 I want excel to say If A1(Today) is greater than 03/14/2014 and less than or equal to 03/21/2014 then unhide column E and hide the rest.
Then let's say Today is 03/22/2014. I want excel to say If A1(Today) is greater than 03/21/2014 and less than or equal to 03/28/2014 then unhide column F and hide the rest.
In one spreadsheet, I want to have a command button that will hide all rows where the date column (column A) shows a date older than one week from today. When this button is clicked again, all rows will unhide again. Preferably the Command button title would change to reflect whether it is on the hide or show cycle (for example "Click to Hide all older than one week" and then "Click to Show all events") .
I have sheet with Oval button and when I pressed the Oval button input box appears and ask for password and I made msgbox if the password is wrong and I made loop 4 times to enter the password then after for trials will exit the inputbox ,But I have 2 problem with my code below
1st problem : when i press the cancel button before I insert any character in Inputbox the msgbox appears which its say the password is wrong
2nd problem : when i press the cancel button before I insert any character in Inputbox the column which the Oval Button exist on it disappear.
Code:
Sub Hide_Sal_Table() Const pass As String = "123" Dim Inp Dim Retry Dim lTries As Long Inp = InputBox("please enter the password", "Zmhnk", vbOKCancel + vbQuestion) Application.ScreenUpdating = False
I am trying to add a gantt chart feature to a project summary worksheet. Ideally I'd like to search Col C (Start date) and Col D (End date) for all projects, and based on the earliest start date (ESD) in C and latest end date (LED) in D, repeatedly insert columns labeled with the value of the ESD (ie Feb 6, 2011), increment by 7 (1 week), insert the next column with ESD+7 and continue on until reaching LED.
I have a situation where i would like to hide and delete a few sheets in my worksheet.
there is a few sheets where i want it to be constantly visible and one sheet is based on a cell reference.
the remaining irrelevant sheets i would like it to be hidden and deleted.
'always visible are sheets that are constantly visible in all files' 'visible msds is the sheet where my product data is being pulled out based on a input i enter on my first sheet' the sheets i want to hide and delete will be the remaining irrelevant "MSDS" that i would like to remove through macro.
I have a spreadsheet that is updated monthly. THe spreadsheet has a column for each month of the year, plus other columns. I would only like to display the current month and all past months - with the future months being hid from view. SO each time the user opened the file all headers with future dates will be hidden from view. I only would like to see the past months and other other no date column information. Is this possible to do in excel?
My spread sheet is a church offering register that is used to record weekly contributions. Column A contains the names of the individual contributors. Columns B through BA are used to record the weekly contributions for each of the 52 weeks of the year. Row 1 of columns B through BA contains the Sunday date MM/DD/YYYY. I would like to have a macro that would scan those cells looking for a date < today. If that condition is true, I would like to hide that column. When date = today or date > today the macro can end. The goal is to have display the current week's column immediately following Column A.
Instructions are in the attached excel as well. Please see attached
If a person puts in a price in column A, that results in column B "Everyday Price Per Unit" being greater than column C "NDP", then highlight column A cell input red.
=Column B>Column C, then turn input cells in Column A Red.
First four highlighted are examples of thise formula scenario
I'd like for my spreadsheet to open with only Column A visible; I'd like all other collumns to stay hidden.
I want to create a marco to unhide column(s) based on the value of an individual cell.
For example:
if I enter the number 5 into cell A1, I would like Columns B:F to unhide. if I enter the number 2 into cell A1, I would like Columns B:C to unhide. Is this possible?
How would I reorder columns & tabs based on a form where the user can put them into order that they would like the columns? I forsee some type of form where the user can dsignate the order and then start a macro that will sort both the columns and tabs.
I need to filter out rows, based on a specific value in column A, (documents on file for the clients), then check column C (last name) and D (client first name), which can have the same client listed multiple times, based on how many different documents are on file ......
On my 'Report' worksheet in cells I1 to Z1 the formula returns "" if there's no data in that month or "1" to "18" depending on which month it is. e.g. if it's a 12 month accounting period then 6 of the columns will have no data in them and will have "" in row 1, the other columns will return 1 - 12 in row 1; if it's a 15 month accounting period then 3 of the columns will have no data in them and "" in row 1 and the other columns will return 1 - 15.
The VBA code below is part of a longer macro on my 'Data' worksheet. The rest of the code works fine and I just wanted to add this bit to hide the blank columns on the 'Report' page.
[VBA] Private Sub Worksheet_Change(ByVal Target As Range)
Application.Calculate With Sheets("Report") Dim i As Integer If Intersect(Target, Range("I1:Z1")) Is Nothing Then Else For i = 9 To 26
macro below that will only hide columns if all the rows (e.g. row 8 to 18) have no value?
Code: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("U18:AB18")) Is Nothing Then Exit Sub If Target.Cells.Count > 1 Then Exit Sub
I have a worksheet that lists the months of the year on row 3 from columns C through N. What I am trying to do is to be able to select the month I want from a drop down list or combobox and then hide the remaining columns based on the selection. For example if JAN is selected the months FEB through to DEC would be hidden.
the problem is that not all the dates in the range are consecutive and there may be the same date more than once eg 01/04/2008 03/04/2008 03/04/2008 05/04/2008
the problem is if the date in cell H20 (inputted by user) does not exist in column D, it all goes wrong.
what i would like to achieve is a way of incrementing the cell date by one day until it matches a date in the range, in this case if 02/04/2008 was entered 03/04/2008 would be picked up.
I am trying to hide columns within a named range, where the range corresponds with the values section of a pivot table.
My code hides an unexpected set of columns. It seems to be affecting a different range, depending on the number of columns in the pivot table, which is not part of the named range, as if there was some kind of offset.
Sub hideAll()
With ActiveSheet.Range("wholeyear") .Range(.Columns(1), .Columns(12)).Hidden = True End With
I am a production manager for a homebuilder and I am trying to create an Excel spreadsheet that will allow me to input a date in a column and have a second column dependant on the date and move as I change the date.
Since no work is done on weekends, I'd like the output column to skip weekends and move the input to the next available weekday. I have conditionally formatted the date to be a red fill as a visual cue but I'm not sure where to go from here.
My spreadsheet uses alternating columns for actual and budget inputs I would like to preload the budget for the whole year But the ytd formula should only show results to match the input of actuals
In otherwords, If I input actuals for period 1, the YTD formulas for actuals and budget should return YTD period 1 only and ignore the remainder of the budget inputs
After period 2 actual inputs, the formulas shlould update to reflect period 2 YTD and so on and so forth
How can I accomplich this? Sample of layout attached Totals at Cols AK-AM
I have been on a very steep learning curve as I try and write a system for my employer (small motor dealership). My boss still does everything by hand as does the stock controller which is very time consuming.
To the point.
My worksheet consists of rows 1-135 and column A-AC
Vehicle stock numbers are listed in column A.
In Column AA is the month in which a vehicle(s) are sold.
At month end I would like to hide all the rows of vehicles that have been sold in a particular month - ie July. So we may have 40 sales in july scattered throughout the worksheet which need to be hidden.
I am trying to automatically hide columns based on dates. I have a set of dates ranging from the beginning of August this year until the end of December 2019. I am trying to hide all columns that are at least a day ahead of the current date. Today on 8/4/13 it would show all columns up until today along with tomorrow 8/5/13.
If column K2:k466 is blank or says "No" then columns L & M are hidden. If it says "Yes" it is not hidden.
Also,
If Column N2:N466 is blank or says "No" then Columns O,P,Q,R are hidden. If it says "Yes" they are not hidden.
Finally,
If Column V2:V466 has a zip code (or number) then columns T,U,W,X,Y,Z,AA,AB,AC are present. If there is no value in any of V2:V466 then they are hidden. .
Is there a way of a user can add a number in a cell and this would hide a different amount of columns.
OR :
Ideally I would prefer a drop down with dates and the user could select a forward date and all the columns with dates up to that would appear. This would mean they could look as far our as required and all unwanted data would be hidden.
worksheet I am working on at the moment, basically if row 5 has a 0 displayed I want that column to hide, but if row 5 has text of any value displayed I want it to unhide, the range is E5 to BA5 across.