Macro To Hide Row
Jul 20, 2006i am looking for correct code to hide a row based on the cell value. for example, if G8 = 0, hide row 8
i am looking for correct code to hide a row based on the cell value. for example, if G8 = 0, hide row 8
I am trying to make a save&close workbook macro.
I found several examples on google, but unfortunatly it conflicts with another macro I use for forceing users to enable macros (hide all sheets except one if macros are disabled).
The attached file is an example contaning the save&close code and the show/hide sheets depending on macros enabled.
If the file is opened with macros disabled then only one sheet will be visible.
If the file is opened with macros enabled other sheets are visible.
The problem if that this code uses a custom save, witch makes the save&close not save... (in module1 and in ThisWorkbook)
The pourpose of the save&close is to make sure some users don't forget the excel open and thus block access to it. So if a certain idele time passes excel has to save and close without any confirmation messages.
I have 2 macros one hides a selection of rows and the other unhides them. What i want to be able to do is when an IF function is true then macro 1 (hide) is used. If the function is false then macro 2 (unhide) works. There is a code in VBA
View 3 Replies View RelatedI'm not a VB programmer and have tried to write this macro but I can't seem to understand why it's not working.
View 11 Replies View RelatedI am looking for a macro to hide all toolbars i am using this at the moment
View 4 Replies View RelatedI have created this macro (below) in a standalone spreadsheet and the expected results are that Columns A,B,C,D,G,H will be displayed after I run the macro.
But when I use the same macro in my production worksheet (columns and ranges adjusted accordingly) this macro creates the following results: Column A is displayed and all the rest are hidden (B,C,D,E,F,G,H). I am stumped as to why this occurs. Can you advice me as to how to get this macro to work and display A,B,C,D,G,H ?
I have the code below, which works fine apart from I get a little square coming up every time I run the code, as this gives you a line the Chr(10) has to be there. When I tale the Chr(10) out the little square disappears but then I don't get a new line. I have set the formatting to "wrap text" but it is still showing up. I am not quite sure where to go from here, I have also done a ="test"&CHAR(10)&"test" and that worked fine with no little square.
View 11 Replies View RelatedI have the following piece of code to hide all worksheets in my workbook but modify it to hide the multiple charts I still have open after running this:
Code:
Sub HideAllSheets()
Application.ScreenUpdating = False
Dim ws As Worksheet
[Code].....
1. I can create basic macros .. but how do I write a macro to hide a range (of 10 rows) named "dmargin". That for my button no. 1.
2. How do I write a macro to unhide the named range "dmargin" for my button #2.
I tried using VB codes to achieve both conditions -- it works but it either continuously protects or unprotects my ws -- so I think it is better to use a low level codes (macro buttons).
optimize the above Mcro to hide rows with "0".
Sub HideRowsw()
With Excel.Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
End With
[Code]...
I made this simple little macro to hide/unhide a row on a different sheet based on a check box. The row hides fine. The problem I have is unhide. I uncheck the box, but the row stays hidden. What am I missing to make this little gem come to life? This is for tracking popcorn sales for scouting and I'm trying to make it as easy to use as possible.
Sub Patrol1_Scout1()
If True Then
Sheets("Show_n_Deliver_Sold").Rows("7:7").EntireRow.Hidden = True
End If
If False Then
Sheets("Show_n_Deliver_Sold").Rows("7:7").EntireRow.Hidden = False
End If
End Sub
I have a series of worksheets in a single workbook. The problem is there are many rows that contain zeros across. The problem is that there is text in that row in case a number does show up there. I need a macro that will hide all of the rows containing zeros or no values.
View 2 Replies View RelatedI have an Excel spreadsheet from which I run a macro to open another workbook. This other workbook has multiple worksheets. The problem I have is that I never know which worksheet was left active whenever it was last saved. How do I revise my macro to open this workbook and make a specific worksheet active and hide all other worksheets?
View 9 Replies View RelatedI've written a macro to unprotect a sheet, unhide columns and reprotect the sheet. It works fine with 2 out of 3 worksheets. I cant find any reason why it wont work in the one sheet....
View 9 Replies View RelatedMaking a macro to work like this:
if each 4th row of each column (A to XFD) contain 1, hide every column that contain 1 at each 4th row..
So, when the result of my formula is 1 on D4, F4, and AB4, then D, F, and AB column would be hidden automatically when I ran the macro..
I'm having a problem with my macro .However, if i use the following script:
[Code]......
If i am correct all the rows with a value less than 1 should be hidden right? However, some rows are hidden when they shouldn't be.
Im working on a quotation with different products in it. And the rows with a 0 in it should be hidden and that's pretty much working. But it also hides some of the subtotals(which i dont want) and some stay unhidden.
continued from: [URL]
Option Explicit forces explicit declaration of all variables in the code. That is why i had to declare ws as worksheet using the Dim statement before using it in the code. It is recommended to have it - however for this code it wouldn't have mattered.
I'm not sure I exactly follow what you imply here. But yes, you can hide all the sheets at first and then "unhide" at the start of the macro. Let's say you have a "Start" sheet.. then:
[Code] .....
The workbook is used by other people too. I cannot just tell them to hide the sheets, it defeats the purpose. What I want is, when macro is disabled, they will only see the START sheet, otherwise, all sheets will be visible. To add to this, a new sheet is added everyday. Sheets name are calendar dates in mmdd format
I am trying to find a library with vb/macros that can hide and unhide all worksheet tabs except one, the formula, and the menu bar.
View 1 Replies View RelatedDevelop a macro that will enable me to hide or unhide worksheets.
Basically, I have a few worksheets in my workbook and I want to have a page at the front with two buttons. One for Unhide sheet and the other for Hide sheet. Once activated, I want it to give me a list of worksheets that I can click to hide or unhide (depending on the button i click).
I just need a quick and easy macro that hides rows that have a 0 in columns H, I, J, K, or L.
View 11 Replies View RelatedI am now trying to hide rows when the data in a column matches that of a cell with a data validation list. Ideally i would like only the rows with matching data to show. When the cell is changed then the visible rows change and when the the entry "total" is selected all the rows are shown. There are several small tables of data on a page so I can't use auto filter. The data areas will also change in size as new entries are added. So the last row in the data tables will increase over time. I will copy and apply the macro to each separate table of data.
As an example cell c19 contains "lwsf"
The data table is in the range c24:q47. the column with matching data is column D so all rows of entries with "lwsf" in column D should be visible and the rest hidden. When c19 is changed to "TF" then the rows visible become those with TF in column D and the rest hidden.
I want to run 2 different macros:
Macro 1- hides Sheet1 and unhides Sheet2
Macro 2- Hides Sheet2 and unhides Sheet1
I used the macro recorder to attempt to make this work but am running into a problem if Macro1 is run two times consecutively. In this situation the macro displays a debugging error b/c Sheet1 is hidden. Is there a way to get around this...possibly using an if then statement?
I am trying to hide/unhide several columns by hitting a button. It's a pretty simple macro to do it once, but how do I get a button to hide on the first click, then unhide on the second?
View 3 Replies View RelatedI have a single button I want to use to call a macro to:
1.Hide columns C:AZ if they arent already hidden
2.Unhide columns C:AZ if they are already hidden.
I would like a macro to look through a sheet.
1. Unhide all Rows
2. Check through all cells in Row, If all cell values in row is either 0 or Empty then hide this row.
I have written a macro to hide any column (within a range of columns) that has an 'x' in it. By putting the 'x' in the column, it allows the allows the user to choose what columns they want to hide. I have an inverse macro as well that unhides those hidden columns.
These macros work perfectly in Excel 2003, but they do not work in Excel 2007. In Excel 2007 I get a compile error: can't find project or library. As a note, all other macros in my spreadsheet (Module 1) work.
I have a formatting macro that I recorded, nothing fancy just bringing in a few different spreasheets, and formatting them. I made this for someone who really doesn't know excel.
I linked this button to the macro and it works great, except at the bottom of the code I would like to put something that when this has run, it hides the button, so it can't be run again.
Does anyone know a more efficient way to run this code?
View 7 Replies View RelatedI have this macro hiding rows, but not the right ones. I am trying to hide all rows where the Len of a cell in column C is > 1? What am I missing here?
View 4 Replies View RelatedI want a code to Hide the row if "sum of numbers in columns three thru last column" = 0. Following is a code I use to delete a row if that is blank. The difference here is that I dont want to to check first two columns and I want to hide them rather than deleting.
View 4 Replies View Related