I have cells, or columns hidden when I do not need them, but I have to a data entered in those cells to make my spread sheet work. Usually just 0.
When I do the all clear or " clear all contents" operation at the end of the day, it clears the hidden data/cells too. Is there anything I can do to stop excel from clearing those hidden cells?
I have a file with Workbook Activate/Deactivate and Worksheet Activate/Deactivate commands in it. When someone is trying to copy information from or to this workbook the VB automatically clears the clipboard (or at least that's how I understand it), which makes it so they can't paste that data anywhere else. How can I prevent this, but still keep my current commands?
I recorded a simple Macro in Excel 2010 to sort data by the first Column, heading "Ref". I have assigned CTRL + e as the keyboard shortcut for this.
My sheet contains a number of hidden rows (as I hide rows when I have finished working on that issue).
When I run the macro, it does sort by the number of Column A, but also, the hidden rows are then shown again.
I realise I could just click on the A-Z sort button to stop this happening, but I really like being able to use keyboard shortcuts, which is why I tried the macro route.
I wondered if it is possible for the macro to ignore hidden rows?
Code: This is the macro: Sub SortByRef() ' ' SortByRef Macro ' ' Keyboard Shortcut: Ctrl+Shift+E
I am trying to format all cells on all sheets (hidden or otherwise) as "Locked" so when the sheets are protected the user can't see the formulas. This macro individually selects every sheet in the book and applys the formatting. Is there a way to modify this code to accomplish the same thing without having it actually select every sheet? The only reason it is an issue is that after running the macro you end up on the last sheet in the book.
I have a spreadsheet that has I have protected. On this sheet I have a button labeled Reset Form. When you click the button it it goes to each Unprotected Cell and deltes the contents. I created this by starting the macro and then tabbing to each and every cell and deleteing the contents I then ended the macro...
Is there a code that I can use for to clear all unprotected cells as opposed to creating the macro manually?
My computer runs on Excel 2003 but my Laptop is on Excel 2000, the problem is I have the below code on a spreadsheet I wrote on my Computer which runs fine but when I open it on my Laptop it comes up with a run time error it doesn’t like the clear contents line. If some one could explain to me why it is happening and how to get round the problem so it will work in Excel 2003 and 2000.
Private Sub Workbook_Open() Application. ScreenUpdating = False Sheets("data").Visible = xlVeryHidden Sheets("Incidents").Visible = xlVeryHidden Sheets("Front Sheet").Select Range("A17:S17").Select Selection.ClearContents Open1.Show Range("A17").Select Application.ScreenUpdating = True End Sub
I am trying to clear the contents of cells in a very large spread sheet containing certain words. I am running the following macro and it will only do the first part, so it will clear cells containing "deceased" but stops at "esa". There may be any number of other words or text in the cell and I want it to delete cells with "esa" by itself so for ex. not delete cell containing "vanesa". I am very amateur so I am sure this is something simple but I cannot find the answer or figure it out for myself.
Sub DeleteAll() Dim lCount As Long Dim rFoundCell As Range Dim rLookRange As Range Set rFoundCell = Range("A1") Set rLookRange = ActiveSheet.UsedRange For lCount = 1 To WorksheetFunction. CountIf(rLookRange, "*deceased") Set rFoundCell = rLookRange.Find(What:="deceased", After:=rFoundCell, _ LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False) rFoundCell.ClearContents.......................
I have a macro where somone fills in a form and then it copies the data in the form to a database (another worksheet). Once the macro is run and has copied the form to the database, I then clear each cell seperately using the below code :-
I have compiled the following code with bits from here there and everywhere to clear the user entered details on a form. My problem is that I need to retain or reset to "Please Select" the cells with drop down lists.
In list form, I am trying to;
Unprotect the worksheet, Select the cells with drop down lists and lock them, Delete the contents of unlocked cells, Selecting and unlocking the cells with the drop down lists ready for re-use, Re-protect the worksheet.
(I probably should mention that my "Form" is just a formatted worksheet that looks like a form on the screen and when printed, not any sort of inbuilt Excel function that I have read about somewhere, probably here)
Code: Sub ClearUnlockedCells() ' ' Clearform Macro ' Clear entered data from Form. ' Dim WorkRange As Range Dim DVRange As Range
I've created (with the help of jmthompson from here) a macro to pull an entire row of data and copy to another sheet (Sheet1) if column U has "YES" in the cell.
Now I need to clear the contents of cells in range B-U after the copy has occurred.
I have a workbook with a series of sheets that have tables for entering data. The table row and column labels and formulas in certain cells of each sheet are locked and some sheets are hidden.
When opening the file I want to clear all cell contents (interior color, comments, data, etc) in all the unlocked cells on each sheet that is not hidden.
I tried protecting the sheets first so only the unlocked cells would be accessible, but when I run the code below I get an error saying that the clear contents etc. cannot be performed because the sheet is protected. If it is not protected, everything gets wiped out.
How can I keep the locked stuff but clear the unlocked cells?
For Each ws In ThisWorkbook.Worksheets If ws.Visible = xlSheetVisible Then
ws.Protect Password:="aaa" 'Protect each sheet ws.Cells.ClearContents 'clear content of any unprotected cells ws.Cells.ClearComments 'clear any cell comments ws.Cells.Interior.ColorIndex = 0 'set background colour to no fill Active.Cells.Range ("a1") 'make the active cell the top left
Code to run a macro called "PriceForm" instead of clearing the cells.
Private Sub Worksheet_Calculate() Static MyMarket As Variant Application.EnableEvents = False Application.Calculation = xlCalculationManual If [A1].Value = MyMarket Then GoTo Xit Else MyMarket = [A1].Value Range("T5:X50").Value = "" End If Xit: Application.EnableEvents = True Application.Calculation = xlCalculationAutomatic End Sub
I am trying to make a function that will only show the value of visible cells (so I can have excel calculate a slope/offset of a filtered table. I made the function below, and it seems to work pretty well.
Option Explicit
Function Visible(x) As Variant Application.Volatile If x.Rows.Hidden Then Visible = "" ElseIf x.Columns.Hidden Then Visible = "" Else: Visible = x.Value End If End Function
However, when I try to use it in an array formula instead of with an individual cell (example, {=SUM(Visible(A1:A10))} ), it only evaluates the hidden property on the first cell. So if the first cell is hidden, all cells will be blank, and if the first cell is not hidden, all values are summed, regardless if some of the later cells are hidden.
I usually use the IF and IFERROR functions with the SUM functionto filter out values I don't want, and I assumed I could do the same with this custom function.
If I have two columns of data, one for mortgage rate and one for loan size, then use a data filter to display a subset of the data, how can I calculate a weighted average on just the hidden cells? Is there any sort of criteria flag that looks for hidden cells in a range? Sort of the inverse of the SUBTOTAL function.
I was wondering if it was possible to hide cells using protect sheet? I have a worksheet that contains confidential data and would like it so the cells appeared blank unless you had the password. I know you can hide rows and columns but I need everything on the sheet to be hidden.
I've unlocked it fine, revealed formulas etc, but it doesn't make sense so must be a hidden formula stopping people like me from unlocking the hidden treasures!!!!
At the moment it stops at column V and I can't get it to unhide any further???
So the find method works on visible and hidden rows depending if you use LookIn:=xlValues or xlFormulas; however, it does not work on hidden rows caused by a filter.
I have a range that is filtered, and I want to find a value in a column that may or may not be the filter criteria (and thus hidden). I do not want to show all the data, do the find, then reapply all the filters again. I could loop through the column, but I am looking to see if Excel offers a more efficient way.
The problem is, it averages all cell values (conditional upon the C column's cell being equal to A2 of course), whereas I only want to average the VISIBLE cells that match the condition.
I have tried using a little VBA with:
Function Vis(Rin As Range) As Range 'Returns the subset of Rin that is visible Dim Cell As Range Application.Volatile Set Vis = Nothing For Each Cell In Rin If Not (Cell.EntireRow.Hidden Or Cell.EntireColumn.Hidden) Then If Vis Is Nothing Then Set Vis = Cell Else Set Vis = Union(Vis, Cell) End If End If Next Cell End Function
and then trying the formula: =AVERAGE(IF(Vis('Data Table'!$C$10:$C$65536)=A2,Vis('Data Table'!$BP$10:$BP$65536))) but it does not work.
im looking for a basic macro for workbook copying, all workbook(all hidden, unhidden, and very hidden) sheets.
i know how to do unhidden sheets of course however the hidden and very hidden are giving me some trouble...i need to also copy over all the macro's, buttons, and drop down box's as well..not just values.
I am working on a file with different users entering information on different sheets (tracking the status of individual projects and activities). Using the macro below (which I found in the forums), the individual data will be combined on a master sheet. My problem is that some of the users will be using autofilters to filter their own data (for example--filtering to show only the "Open" projects). When I do the copy of the individual data, I want ALL of the data, not just the data that is being shown by the individual filter settings.
At first, I just turned the individual filters off before copying the data. The other users have asked if there is a way around this or alternatively, restore the filter values after the copy.
A key point, there are currently 8 user sheets. Each user is allowed to set their own filters and change them at will-e.g. one day, a user may filter on projects due in Q3, another day she may be looking at all projects closed in 2013.
VB: Sheets("Combined").Select ActiveWindow.SelectedSheets.Delete Dim J As Integer On Error Resume Next
I have set my 'lastrow' to the last value in column A. The problem is, this code gets run whenever an autofilter is made. As a result, the 'lastrow' records itself as the last row of visible data. In reality, I need it to track the actual last row of total data.
I have conditionally formatted (Bold Italic) some data (the highest value in each column) and I have a macro that hides rows dependent on one value in that row. However I would like the conditional formatting to apply only to the visible cells, so that if the maximum value is in a row that is hidden the conditional formatting is applied to the highest, non-hidden value.
how to calculate a simple average after removing duplicates. The trick is the average must work after the spreadsheet is filtered. I was able to make it work with a VBA script but the users don't like this since the numbers don't automatically update whenever they apply a different filter.
What I need: average (mean) value of (in this case age in years) based on unique ID#s that doesn't include duplicates (some ID#s are in database several time):
ID# Age Filter Options
11111 27 Option A
11111 27 Option A
[code]....
So if I filter by Option C, the cell with the average should return the average age of only the filtered ID#s but without the duplicates.
Correct age w/no filter: 56.8 Correct age w/option C: 59
What I have tried using: (reason for difference in cells on the equation, I condensed it in the above example so A=C and B=G)
This array works but will return hidden and non-hidden cells b/c of average(if), so it doesn't work with filter:
{=AVERAGE(IF(C3:C13C4:C14, G3:G13,FALSE))}
Also have tried the Subtotal 101 function, also with no luck: Note, a simple subtotal101 fxn will not work b/c even when I filter there will still be a few rows that are duplicate and need to be removed before averaging
I am applying the sum function to a range of cells in a column. I've Auto Filtered my sheet to only include the data I need. Unfortunately, the sum function is adding everything in that column, even data from the 'hidden' cells that I've filtered out. I need to know what condition or parameter to apply to the sum function (or any other function for that matter), that will only add the data shown on my screen. Not the data that is hidden.