Forum Discussion
Shipwreck818
Sep 24, 2023Copper Contributor
Excel, unbale to get a VBA macro working to hide rows
Hello everyone I can relaly use some help as my VBA macro abilities still need more practice.
I have the tennis elbow to prove it becuase I am in pain.
My project consists 7 Primary Funcitons we call (Versions or Functions) that we must work with and impossible to memorize due to each uniqueness.
Of those 7 functions, they are relying on a specific date range, the date entered would choose the function. That is the easy part.
Now for the difficult part.
Once the function is known based on the date , I was intending on that Function/Version only appearing and all other rows to be hidden. That is basicly it.
My goal is to type in a date in sheet 2, then the function appear based on the date. All other versions will be hidden. SHeet 1 will also be hidden as that only figures the version based on the date entered in Sheet 2.
I looked at several hide rows videos, atempted a VBA MAcro however could not get it to work.
I am open to suggestions, even a better way to present this.
I posted a link. Thank you in advance for your time.
I kept the versions at only 2 for now to test and still no luck.
See the attached version.
If the end date is left blank, it will work as before.
If you enter an end date, ALL sections that overlap the period from start date to end date will be displayed.
The formulas now use Sheet3. I left Sheet1 in the workbook, but it is not used anymore.
16 Replies
Sort By
The code should react to changes in B2, since that is the cell edited by the user.
Worksheet_Change does not react to changes in B4 since it contains a formula.
In the attached version, I changed the formulas on Sheet1 since they didn't work on a system with non-US dates. It should now work regardless of the date format.
See the attached version.
- Shipwreck818Copper Contributor
Thank you so very much!
You have no idea how must elbow pain I have been in this past week trying to figure this out and creating the branching questions.
I have a follow up question to this sheet.
Lets say I had to had an end date, say B3 for example.
How different would that be if the dates overlapped into 2 or 3 versions?
I am worried we may need to add that down the road.
Thank you!
See the attached version.
If the end date is left blank, it will work as before.
If you enter an end date, ALL sections that overlap the period from start date to end date will be displayed.
The formulas now use Sheet3. I left Sheet1 in the workbook, but it is not used anymore.