Set (LastRow) As Dynamic That Counts Hidden Cells
Jul 30, 2013
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.
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
View 9 Replies
ADVERTISEMENT
Jul 19, 2007
I'm having a problem moving the cell cursor 2 rows down once I find my LastRow (see LastRow code below). My problem is I need to move down 2 VISIBLE Rows down and I'm running into it moving 2 Rows down whether they are Visible or Hidden? If Row 50 is my LastRow, and I have it move 2 rows down, if Row 52 is Hidden, it still moves to Row 52 which can't be seen by the user after I do my stuff to that row? I can't unhide any hidden rows for other reasons. Is there a way to have the cursor move down 2 VISIBLE Rows instead of 2 Rows regardless?
The code I use to select the LastRow is:
LastRow = Cells(4000, 8).End(xlUp).Row
I move down 2 more rows using:
Cells(LastRow + 2, 8).Select 'Then I do some stuff here for the user, so it can't be a hidden row
View 9 Replies
View Related
Feb 28, 2014
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.
View 7 Replies
View Related
Sep 14, 2013
I have a range that contains a mixture of hard coded data and data pulled from a database sheet. I want to average only the hard coded data not the ones in the cells containing formula. I need this to be dynamic instead of just selecting the cells as formula might be added later on.
View 1 Replies
View Related
Feb 17, 2014
How do I write a bar chart which reads the format of a cell instead of the content? ie I want to count how many cells in each column are amber. Amber cells have already been decided by conditional formatting.
See demo attached : bar chart demo.xlsx
View 6 Replies
View Related
Jun 19, 2009
How can i change this so my lastrow= is the lowest cell of A B or C?
Something like tis
View 6 Replies
View Related
Oct 17, 2012
I am using Excel 2010. I created a macro to fill a report. Each section of the report is a department, each department has 53-55 (I forget the exact number) lines underneath the department number. So in the macro, for each department I am trying to use the code block
Code:
If Not IsNothing Then
If WorksheetFunction.CountA(Cells) > 0 Then
LastRow = Range("D60:D114").End(xlUp).Row
[Code]....
The font in red is the variable range. The first department has Range("D58").End(xlUp).Row for example. When I run the second department, it finds the empty cell under the first department's section. For example: I go to run the second department with the range of D60:D114, the cell that is selected by the "Address = "portion of the code is D10, because D4-9 has information in it.
What I need is for it to see that D60 (or D61, etc) is empty and paste the copied information into that cell. I am trying to find a way to do this without using "If cell D60 > 0 Then Activecell.Offset(1,0)", because this is a yearly report being filled in every week.
View 5 Replies
View Related
Jan 15, 2008
The problem is that LastRow does not seem to look in the workbook that the macro has open, and always returns a value of 1. If I place the sheet that i want to run the macro on, in the workbook that contains the macro there is no problem. What do I need to do to fix this.
LoopCount = Sheets("Dates").Range("A" & Rows.Count).End(xlUp).Row
rng = 2
i = 1
Do
Selection.AutoFilter Field:=7, Criteria1:="=" & Sheets("Dates").Range("A" & rng), Operator:=xlAnd
z = Range("B" & Rows.Count).End(xlUp).Row
For y = 2 To z
If Rows(y).Hidden = False Then Exit For
Next y
MsgBox y
MsgBox z
Range("H" & z).Formula = "=Countif($A$" & y & ":$A$" & z & ",A" & z & ")"
Range("H" & z).Copy Destination:=Range("H" & y & ":H" & z)
rng = rng + 1
i = i + 1
Loop Until i = LoopCount
View 9 Replies
View Related
Aug 20, 2014
I know how to get the last row for columns, usedrange... etc but I don't know how to get the lastrow based on multiple column range
For example, find the last row between columns A:M but IGNORE N:O however we still want to check/get the last row for P:Z
View 11 Replies
View Related
Oct 28, 2009
What I'm trying to do is add a line where it counts the number of cells with either the word "NEW" in a certain row (Countif) or the number of cells with a value in a range(Counta). CountA is not working because if I run the macro twice it adds a second total line and messes both the count and total up. COUNTIF I just cant get to work because im a VBA SUPER NOOB and im just pieceing code together from this forum and the net.
View 5 Replies
View Related
Feb 16, 2009
I am copying a range of rows (which include some hidden rows). When I paste them I see all the rows. Is there a way to retain the hidden attribute?
View 2 Replies
View Related
Apr 7, 2014
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.
View 3 Replies
View Related
Feb 27, 2007
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.
View 9 Replies
View Related
Aug 10, 2014
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?
View 3 Replies
View Related
Aug 19, 2009
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.
View 2 Replies
View Related
Sep 3, 2009
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???
Used the edit, go to, etc won't go.
Deleted all code in vb I can see or find
Tried clicking on all sheet and unhide
Nothing!?
View 9 Replies
View Related
Jul 26, 2009
I'm trying to copy a range with hidden rows,
but if i do like this:
range("A1:A10").copy Destination:=Range("A15")
but, as i said, some rows are hidden and i want copy them too.
Unfortunately Excel copy only visible...
How can i copy an paste hidden cells too?
View 9 Replies
View Related
Jun 10, 2009
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.
View 9 Replies
View Related
Jul 18, 2007
I have a large data table that has autofilters on the headings.
I also have a "Data Summary" Sheet in which I would like to get a conditional average.
Here is my *working* array formula:
=AVERAGE(IF('Data Table'!$C$10:$C$65536=A2,'Data Table'!$BP$10:$BP$65536))
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.
View 8 Replies
View Related
Jun 30, 2007
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.
View 4 Replies
View Related
Jul 9, 2014
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
[Code] .....
View 2 Replies
View Related
Oct 2, 2012
How to get the LARGE function to ignore hidden cells? Is it possible?
I have a filter in a data set and am using a macro to pull in the top 5 largest values.
View 3 Replies
View Related
Feb 1, 2014
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.
View 9 Replies
View Related
Apr 24, 2014
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
=SUBTOTAL(101,(IF(C3:C13C4:C14, G3:G13,FALSE)))
View 3 Replies
View Related
Jan 28, 2007
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.
View 2 Replies
View Related
Feb 21, 2014
How can I block the hidden cells, so that when I want to copy/paste into another workbook, pasted data has to be all, except hidden&locked cell?
View 4 Replies
View Related
Aug 5, 2014
I have searched all over and read many solutions for selecting only visible cells and copy pasting them or formatting them by doing Ctrl + G and selecting visible cells only. However the problem is once I select visible cells only, it seems that every time I do Ctrl + C on filtered Range it only selects visible cells. I want a way to toggle this setting in Excel. I'm using Office 2007. For example: if I want to select the entire range, both hidden and visible cells within the selected table array, is there anyway to reverse or toggle the setting that causes Excel to refresh the "visible cells only" setting back to default or all cells?
It would be a much faster way than to remove all filters, select & copy entire range, and then re-apply all filters again.
View 5 Replies
View Related
Feb 5, 2009
I have a formula to search a sheet for certain criteria and sum up the total, data is entered into this sheet by week number, where I then filter it for whichever week I need. I following formula works fine, but adds all the cells including hidden ones, how can i get it to ignore hidden cells??
=SUM(IF('FT Line 1-RX'!$C$2:$C$2100='FT costs 1-Rx'!B$1,IF('FT Line 1-RX'!$E$1:$GT$1='FT costs 1-Rx'!$A11,'FT Line 1-RX'!$E$2:$GT$2100)))
There is raw data in the 'FT Line 1-RX' sheet which is summed up in the 'FT costs 1-RX' sheet.
View 9 Replies
View Related
Mar 7, 2012
Any way to automatically "rank" cells, ignoring any hidden rows? I don't even really need Excel to sort for me (although I wouldn't be opposed to that), but I'd like the first non-hidden cell in column A to always say "1" and the second one to say "2" and so on.
The back story, if you need it: I have a spreadsheet that tracks sales for 2 separate brands. I've created a macro and linked it to a listbox, so that you can choose which brand you want to view and Excel will hide all rows that aren't pertaining to that brand (I'm absurdly proud of that accomplishment). The only problem is the rankings are hard-coded, so when you hide one brand the rankings no longer make sense.
Every Monday I sort the items by the most recent week's sales and rank them from there. The addition of a second brand is obviously new to my little spreadsheet!
View 1 Replies
View Related
Jan 13, 2014
I am having trouble with my VBA code, it hides groups of rows (projects) based on the contents of corresponding cells above. these have either 'yes' or 'no' in them (indicating if the person is active in that project). The Yes/No is formula based from another sheet.
what I am trying to do, is have particular cells, withing the projects rows, locked (as they are also populated by formulas) but have other cells open for editing.
when I try and do this i get an error with my VBA, i am assuming that as cells are locked, the VBA is prohibited form hiding inactive projects/rows. i tried an addition at the bottom but this hasn't worked
Code:
Sub Worksheet_Calculate()
Dim i As Long, StartRow As Long, EndRow As Long
StartRow = 13
[Code]....
View 1 Replies
View Related