Hide Columns In Sheet Based On Value In Double Clicked Cell
Jun 4, 2014
I have a workbook with two sheets, Project Overview and Projects Detailed. In Project Overview column K is different project numbers and what i need the code to do is when this number is pressed it has to go to Projects Detailed and search for this number in column AV and hide the lines that does not correspond with the number that has been double clicked.
In project overview you should only be able to press the numbers from row 9 and down and in Projects Detailed the numbers in column AV also starts in row 9. Some of the cells in column AV are empty and these should also be hidden.
how to remember or pass the place where the user doubleclicks. I am trying to make a form show up when a certain range is chosen. For now this range is static, but it will be dynamic in the future. Once the user double clicksa cell in this range, the form pops up.
Code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Not Application.Intersect(Target, Range("M4:AF23")) Is Nothing Then Cancel = True
Is there any option to deactivate the "Disable macros"
Or
When i open the userform it asks for enable and diable macros. If i click "Disable macros" then the users can manipulate the data inside the excel sheet. i need to avoid this problem.
So, is there any option that if i do "Disable macro" then the corresponding sheet for the which the Userform is linked should not be visible or 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.
I got an excel, with a "validation list" in a certain cell.
Users can select value1, value2 or value3. based on this value, some columns will have to unhide (standard= hidden) (only for value2 this is the case).
I used the worksheet_change event to determin the value, but so far I'm only getting it to hide...
Code:
Private Sub Worksheet_Change(ByVal Target As Range) If C24 = "value2" Then Columns("H:O").Hidden = False Else Columns("H:O").Hidden = True End If End Sub
I need to write a macro that will hide and unhide columns based on a cells value. I know how to write it to hide and unhide rows, but i can figure it out for columns.
For the rows I am using the following:
Sub HideRowsSavings() Dim LR As Long, i As Long Application.ScreenUpdating = False With Sheets("Savings #4") LR = .Range("A" & Rows.Count).End(xlUp).Row
I need to hide columns in a spreadsheet without using the hide/unhide columns option. I found an article which suggested setting up a combobox from the forms toolbar, this is populated by an input range and linked to a cell for a numeric value. The article although using a macro to hide rows suggested this code
Private Sub ComboBox1_Change()
If ComboBox1.Value = "A" Then ActiveSheet.Range("1:3").EntireRow.Hidden = True ActiveSheet.Range("4:6").EntireRow.Hidden = False ElseIf ComboBox1.Value = "B" Then ActiveSheet.Range("1:3").EntireRow.Hidden = False ActiveSheet.Range("4:6").EntireRow.Hidden = True End If End Sub
I want to amend this code so that when the number in my linked cell changes the various columns are hidden.
For example if the cell link number = 1 hide columns e to az if the cell link number = 2 hide columns d and f to az etc.
I have had varying success with amending this code to entirecolumn.Hidden and changing the Combobox1. to dropdown1. but am unable to get it to work, I also stupidly deleted the code that was partially working and am now unable to remember what I'd done.
I've attached one speadsheet :- "VBA.xls". The following conditions are to be done:- 1. When D2=1, Column "F","G" are visible & Column "I","J","L","M" are hidden. 2. When D2=2, Column "I","J" are visible & Column "F","G","L","M" are hidden. 3. When D2=3, Column "L","M" are visible & column "F","G","I","J" are hidden.
I want to hide and unhide columns based on a cell's value.
If D6 of the ‘Summary’ Worksheet Is <> to ‘Test1’ and <> ‘Test2’ THEN Hide columns D:K of the ‘Charts – Source Data’ Worksheet OTHERWISE Unhide columns D:K
I am trying to hide/unhide columns based on what is return to cell C2 from this lookup (=VLOOKUP(B2,GM!E2:M129,9,FALSE)). It can only return 3,6 or 9
If it returns 3 I want to hide columns I:P If it returns 12 I want to hide columns E:L If it returns 6 I want to hide E:H and M:P
I have been trying to work with this code which I found on this forum but I haven't been able to get it working fully. It only works when C2 is entered rather than calculated and I can't get it working for the M:P part of the third option.
Code:
Private Sub Worksheet_Change(ByVal Target As Range) Dim Changed As Range Set Changed = Range("C2") If Not Intersect(Target, Changed) Is Nothing Then Range("A:Z").EntireColumn.Hidden = False
I have written a VBA procedure which is supposed to hide unneeded columns (based on the a number entered in a certain cell. This is working so far. Since I need to sum only the visible cells in a row i need to clear the contents of a range of cells if they will be hidden. Unfortunately the code i have written runs only to the ClearContents and then starts over from the beginning. If i take out the .clearcontents and put .Select for example instead, the code runs perfectly. Here is the
Sub worksheet_calculate() 'Hide columns that are not needed
Sheet1. Unprotect
Application. ScreenUpdating = False
Dim i As Integer Dim r As Integer Dim s As Integer Dim rngRange As Range
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column <> 13 Then Exit Sub If InStr(Target.Value, "Other (specify in next column)") Then Columns("N").Hidden = False ElseIf WorksheetFunction. CountIf(Columns("M"), "Other (specify in next column)") = 0 Then Columns("N").Hidden = True End If End Sub
but I have a lot of columns that I need to perform as above and I have put the code together as below
Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next
If Target.Column = 13 And InStr(Target.Value, "Other (specify in next column)") Then Columns("N").Hidden = False ElseIf WorksheetFunction.CountIf(Columns("M"), "Other (specify in next column)") = 0 Then.................
Using the above code, when I selected more than one cell anywhere in my workbook and pressed delete I was bugging out with a runtime error 13 message. You can see from the above code that I inserted "On Error Resume Next" - this got rid of the runtime error 13 message, but now when I select more than one cell and press delete, hidden columns are incorrectly revealed in my worksheet. how I can extend the working code at the top of this posting so that it works for a number of different columns in my Worksheet i.e. without the runtime error 13 occurring and without columns being incorrectly revealed.
I have a sheet called "Summary", there is a cell, AR8, of that sheet that is linked to other sheets. If AR8 of "Summary" has a value other than 0 I would like it to unhide. But if the value goes back to 0 again I would like it to hide itself again.
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.
Is there a way to hide a group of cells based on the value of a cell in another sheet?
I have attached my spreadsheet.
So, based on the selection in H5 on the 'Wood Selection' sheet, I would like to hide cells on the 'Moisture Controlled Schedule' sheet, and the 'Time Controlled Schedule' sheet.
If Ponderosa Pine is selected, I want it to hide all the douglas-fir info, and vice versa
I have a master sheet where users can change the name of 20 different sheets in the workbook by changing a cell value on the master sheet. Here is the code:
Code: Private Sub Worksheet_Change(ByVal Target As Range) Dim rCell As Range If Target.Cells.Count > 1 Then Exit Sub
[Code]....
The next step which I am having issues with is hiding the sheets. I want all sheets in the workbook to be hidden except for the master. I only want the other sheets to be visble if the user inputs a name on the master sheet.
So if the cell contents on the master sheet, say "B9", is blank, the sheet in the workbook that corresponds to that cell will remain hidden. If the user inputs anything, say "Sheet1", in cell "B9" on the master sheet, I want that sheet to become unhidden and to be named "Sheet1"
Essentially what I want can be shown in outline form:
I. Stats (workbook) A. 2009 (worksheet) 1. Jan (worksheet that appears only when 2009 worksheet is clicked) 2. Feb (worksheet that appears only when 2009 worksheet is clicked) B. 2010 (worksheet) 1. Jan (worksheet that appears only when 2010 worksheet is clicked) 2. Feb (worksheet that appears only when 2010 worksheet is clicked)
I was hoping there was a way to have one workbook that displays only the years (2009, 2010) as worksheet tabs but once clicked, would reveal 12 nested worksheets (one for each month). Once a different year worksheet was clicked, the month worksheets currently displayed would hide again.
How to run some VBA code only when double click any cell of three different columns (say A, G,H) and not run in any other cell. This is being run in Excel 2007.
I'm trying to hide columns M:R on sheet "1up" if cell N4 on sheet "Fill In" is blank and unhide those columns if N4 contains an "X". Columns AK:AP should also hide or unhide on "1up" if AD4 is blank or not on "Fill In".
I've pieced together the below code by recording macros and piecing together code I've found in other threads on here. I placed the code in Sheet 1 (Fill In).
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range("N4").Valuse = "X" Then Sheets("1up").Select Columns("M:R").Select Range("M7").Activate Selection.EntireColumn.Hidden = True End If Sheets("Fill In").Select Range("N4").Activate If Range("N4").Valuse = "" Then Sheets("1up").Select Columns("M:R").Select Range("M7").Activate Selection.EntireColumn.Hidden = False End If Sheets("Fill In").Select Range("N4").Activate End Sub
I have a list of numbers in column B of one sheet.
these numbers are unique and randomly allocated to other sheets in the workbook.
i would like a macro which when a user double clicks on a cell in the list of numbers .. the macro will jump to the sheet containing that number.. (i.e. do something like the find function)...
I have some code below which might be useful for you but I can't work out what I need to write.
With reference to attached file. I want to copy column D&E for 'n' number of times of value based on B1. If value in cell B2 is 0 then hide cell D&E and if there is any other value, excel to copy E&F to next column (leaving one column blank after each paste).
What in the world did I do now? When I click on any cell, the cursor turns into a thick "+" . Then, when I move my mouse up and down the spreadsheet, all the cells the "+" touches become highlighted.