2-level Dynamic Grouping Of Rows
Jul 8, 2008
I have a spreadsheet that requires grouping at two levels. See pasted image below.
I need a macro that on the first pass dynamically creates groups of different sizes of data based on values of one column. For example, a group is created for the RR's, a group is created for the SS's, and a group is created for TT's.
On the second pass I would like to group the groups based on the values of another column for the 2nd level of grouping. So the A's would be one group and the B's would be the other.
TotalAAToTalRRARRARRARRAToTalSSASSASSASSATotalTTATTATTATTATotalBBTotalUBUBUBTotalVBVBVBVBVBTotalWBWBWBWB
I can have 2 tables set up for the values that I need grouped at each level.
Table 1Table 2Group 1Group 2ARRBSSCTTUVWXY
I had recorded a macro where I manually grouped the data. However, this did not help, because I am creating a template that needs to dynamcally handle the data that comes in.
View 9 Replies
ADVERTISEMENT
Dec 23, 2008
I am looking for some assistance to make pivot tables with multiple data values against a control item. A sample excel file is attached herein with. I am quite new to pivot tables was unable to find out a solution self.
View 2 Replies
View Related
Oct 4, 2005
I have a spreadsheet which I distribute weekly to certain people.
It is basically a top level view of incidents, which shows the following.
Sheet Number 1 is :
Person - Count
Joe Bloggs - 42
Fred Bloggs - 12
And so on.
This shows me a summary of how many incidents per person have been logged.
Sheet Number 2 is the actual raw data for that count, so it shows every line.
So in the above example, there would be 42 lines for Joe and 12 for Fred.
What I'd like is to put a hyperlink on sheet 1, whereby if you click onto Fred's name, it will take you to sheet 2 and autofilter to only show Fred's records (i.e 12 of them)
View 9 Replies
View Related
Jun 19, 2007
I have a form button on a worksheet which calls a specified macro, is it possible to have the text which shows on the button, dynamic? I have created a template excel file, which the user needs to set up as they see fit. I have a separate page which is an 'admin' page where they can customize the narrative in the main template, which includes being able to change the text on form buttons on sheet 1. I have tried with this: Sheets("Approvals").Object("Button 1").Text = Sheets("Admin").Range("e14").value
This unfortuantely results in a "run time error '438' Object doesn't support this property or method". From that i would assume this function is not available, but i'm hoping someone may know a way around it??
View 5 Replies
View Related
Sep 15, 2014
I have a table with outstanding days for Funds owed by multiple accounts which dynamically changes everyday I am looking to group this table by >5days, 6 to 14 days , 16 to 40 days ,>40 to 90days and >90days consistently even though the table will change dynamically every day..
View 4 Replies
View Related
Mar 31, 2014
*I have my document ordered hierarchically with group functions.
*Aesthetically I would like to have the font size get smaller the more levels into grouping they are.
*For aesthetic reasons I have merged cells rendering auto-fit useless as it auto-adjust to the first column's font size even if it has no characters in it
I find myself contemplating manually adjusting all 500 some rows of data.. probably by selecting ranges with ctrl or shift clicking my way through the document, grabbing ranges based on how high their grouping is, and adjusting the whole selected group at once, so they all have a uniform height setting.
Can I do some kind of conditional formating based on group level? like all group level 7 rows have a row height of X.
View 1 Replies
View Related
Jul 24, 2009
Below is the partial copied text of a Multi Level BOM. I am trying to hide or unhide the rows with 4, 5, 6, 7, 8 and greater number of dots. The dots indicate the level of BOM.
Would a macro make the task more automated?
View 9 Replies
View Related
Feb 4, 2005
I have VBA code which selects a group of rows ranging between 1 row and 25 rows. I then want code to group the selected rows, however, the only code I know for grouping requires that I enter a specific starting and ending row (ExecuteExcel4Macro "SHOW.DETAIL(1,#,FALSE,#)").
Is there a way to have VBA group and hide a number or rows which is not known in advance and will change between daily executions of the code?
View 3 Replies
View Related
Oct 21, 2009
I am having a problem with a VBA macro I am trying to write. All I want to do is check all rows in a worksheet and group rows from the last bold row to the next bold row.
I seem to have the conditional logic correct, however, instead of grouping rows separately in each loop, it keeps joining them together.
View 6 Replies
View Related
Apr 26, 2012
I have a grouping and subgrouping of rows in my worksheet and I want to use the minimum value from each group and subgroup and use those values in a report on a separate worksheet using vba. Here's the situation
Emp List (Column)__________________________ Salary
- Workers
__+ Foremen
__- Juniors
____John__________________________________2000
____Max___________________________________1800
____Sandra_________________________________1925
- Management
__+ Seniors
__+ Middle
Lets say Max has the lowest salary among all the workers then I want the report to look like this
Emp Group__________ Emp____________________ Min Salary
Workers____________ Max____________________ 1800
Can I do this using vba without multiple loops at all the group levels?
View 7 Replies
View Related
Jun 5, 2012
I have a permutation with repeatition of 3 letters in 9 digits 3^9, and I'd like to be able to group all posibble permutations something like:
BBBBBB+2+1 = BBBBBBCCD = 252 rows
BBBB +3+2 = BBBBCCCDD = 1260 rows
5+4
5+3+1 and so on
View 2 Replies
View Related
Jul 7, 2009
I have a pivot table (vendor spend report) which has over 7000 rows of data. There are 38 vendors (some vendors appear multiple times i.e. Accenture Itay, Accenture Germany, etc.). Vendors names are in column B.
I need to have the VBA script search for each of the vendors (and related names) and group them together. Also, last one is for all the MISC. vendors which need to be group together (one's that dont belong to the 38 managed vendors).
Also, I need to rename the Group for each one; rather than Group1, I need to name it "Accenture All" etc...
View 7 Replies
View Related
Feb 27, 2007
I have a report that shows 3 lines for each item. Is there a way to group sets of 3 rows together so they print on the same page so that it would insert a page break either before or after each set of 3 rows, not between them.
View 9 Replies
View Related
Feb 3, 2012
I need to totally ungroup existing grouping of rows in a sheet. Totally ungroup = strip it totally of any grouping. In short, it should be back to its original state of no grouping at all.
Problem is that I do not know if the sheet has existing grouping, or if it does, how many levels of grouping.
The solution I have in mind right now is just to indiscriminately run ungrouping vba line 10X and just place an error handler i.e.
Code:
Sub Macro1()
On Error Resume Next
Range("A5:A29").Rows.Ungroup
Range("A5:A29").Rows.Ungroup
Range("A5:A29").Rows.Ungroup
Range("A5:A29").Rows.Ungroup
Range("A5:A29").Rows.Ungroup
[code].....
Is there a shorter way to handle this code-wise?
View 3 Replies
View Related
Feb 27, 2014
Here is my code.
Currently I get a 1004 error. "Method of Range of Object _Global Failed" on "Range(Selection).Sort.SortFields.Clear"
Code:
Sub sortBacklog()
Dim appExcel As Excel.Application
Dim myWorkbook As Excel.Workbook
Dim myWorkSheet As Worksheet
Set appExcel = CreateObject("Excel.Application")
Set myWorkbook = appExcel.Workbooks.Open("C:Backlog.xls")
Set myWorkSheet = myWorkbook.Sheets(1)
[code]....
View 1 Replies
View Related
Nov 30, 2009
I have searched for this on the site as I thought it would have already been asked but I couldn't find anything. I have a formula in cell C7 which I wish to copy both down to the last row (xlup from column A) and across to the last column (xltoleft on row 6) but I cant seem to work out how to do it. I have used the .autofill before but for dynamic rows only. Is it possible to do for columns too?
View 2 Replies
View Related
Nov 11, 2008
In a macro, I need to apply a formula to a dynamic number of rows (the lenght of the file will change evryday).
My problem is that when I have recorded the macro, the code tells to apply the formula from row 1 to 3 as today there are 3 rows in my file but tomorrow i might have 10 or 1000.
What code should I use to apply the formula to as many rows as my spreadhsheet contains?
View 9 Replies
View Related
Nov 16, 2006
I wish to create a Pivot Table. It is based on source data with fixed columns (A to W) and dynamic rows. The following is my
Dim WS As Worksheet
Dim DataRange As Range
Set WS = ThisWorkbook.Worksheets("sheet1")
DataRange = Range("A1:W1", Selection.End(xlDown)).Select
ThisWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=WS.Range(DataRange)).CreatePivotTable _
tabledestination:=Sheets("sheet2").Range("A1"), tablename:="PivotTable1", defaultversion:=xlPivotTableVersion10
Dim PT As PivotTable
Set PT = ThisWorkbook.Worksheets("Sheet1").PivotTables("PivotTable1")
PT.PivotFields("Type of Work").Orientation = xlPageField
PT.PivotFields("Profit Center").Orientation = xlRowField
PT.PivotFields("B/(W) CTD Net Rev").Orientation = xlDataField
Because I'm going to use it in my work, it must be reusable. And every time I use it, the numbers of row are different. Therefore, I made the source data into a dynamic range. The range changes when rows change. However, problem always appears in the following line:....................
View 2 Replies
View Related
Dec 7, 2006
create a Dynamic Named Range for Pivot Tables
the pivote table takes data from A1 to Kx
x is the last row of column K that is not 'blank' ( whenever I insert a new row),
I already know how to define a zone but not know how to to make it "dynamic"
View 5 Replies
View Related
Jan 17, 2007
I'm trying to hide all rows from row 3 to a variable row. I've struggled to simply select the rows that I want to hide. I have managed to select a range (containing the rows that I want to hide). I now need to select the rows contained in the range currently selected and then hide them. My code is as follows:
Sheets("Program").Activate
Activesheet.Range("B3").Select
Sheets("Program").Range("B3", ActiveCell.Offset(LastProgramRow - 10, 0)).Select
Selection.Row.EntireRow.Hidden = True
The last line of code fails. I have tried modifying it to variations of:
Sheets("Program").Row (3), ActiveCell.Offset(LastProgramRow - 10).Select
but this also fails. How can I change this code so that only the row is selected and not a column?
View 2 Replies
View Related
Jun 23, 2014
I have a list of several hundred columns, beginning with column "G:G", with varying numbers of rows of data in column - each row dipicting a monthly data point. I'd like to average the numbers in each column (need to average over the appropraite time-frame) and compare that average with the corresponding average (same time-frame) for benchmark (column"F:F"). The problem is I don't have the same number of data points in each column; some have data points for every month for the past 33 years, and some just a few years; almost all have differing beginning and ending dates as well.
[Code] ....
View 9 Replies
View Related
Jan 28, 2014
I am trying to select rows in excel using a macro and then hide the rows, but i want to be able to add rows within this selection and still be able to hide the complete selection of rows.
The macro i am currently using is shown below: This hides rows 131 - 205, but if i was to add in another row in between so the range i now want to hide is 131-206 can i get the macro to update to this new range?
[Code] ......
View 10 Replies
View Related
Jan 30, 2014
In column C I got some data like this:
Number of .csv
01
02
03
04
Number of .csv
05
06
07
08
Notice that there is an empty cell in between.The data starts at C12 up to C21. The data is in Sheet2.There are also 8 more sheets( Sheet3 to Sheet10). I want to rename each sheet, starting from Sheet3 according to each cell. For example the Sheet3 to be renamed to 01, Sheet4 to 02.
What I can do is something like this:
[Code] .....
And repeat this code for every block of data I got by changing everytime the i and the a. But this method is not so optimized because there are cases that the number of rows for each block is not the same and I have to change everytime the i counter. Is there any way to do 1 loop for all the sheets using maybe Worksheets.Count and another dynamic loop for the rows ? The data always start every 6 rows eg( C12, C18 etc). Also I was thinking to define an integer representing the number of rows for the loop...
View 6 Replies
View Related
Jan 5, 2009
I am still trying to develop a macro that will copy and paste a set of formulas into a dynamic destination range. I have included a worksheet that shows what I am trying to do. Basically when using AutoFill I need the columns of the destination range to be dynamic based on the number of rows in another sheet.
View 13 Replies
View Related
Jun 28, 2013
Im working on a macro that i need to delete any row that contains 0 or blank in a dynamic range that starts at H23.
View 1 Replies
View Related
May 29, 2007
i have data that will vary from item to item in the $ of rows associated
and the # of columns to be dealt with.
item1 Line 1
Line 2
Here i want to have a formula put and copied across X columns
item2 Line 1
Line 2 other data going across in the columns
Line 3
Line 4
Here i want to have a formula put and copied across X columns
item3 Line 1
item4 Line 1
get my meaning??
columns involved will be known before i get to this bit of code !!
as an example lets say it's 8 columns
using the record macro i get this bit of code
Range("E14:M14").Select
Selection.FormulaR1C1 = "=SUM(R[-10]C:R[-1]C)"
This is fine but i don't know what row or the columns are before i run the macro so the Range
("e14:M14").select wont really work.
I've sent sometime going through MRexcell searching for tips but found nothing also googled for dynamically pasting across unknown columns
this is close to my idea in my mind conceptually
Range("C2:C" & LastRow)
but it doesn't make the columns dynamic eg column 8 being = H and then P = 8th column on and the last with data.
View 9 Replies
View Related
Mar 13, 2009
I saw this macro posted by Fengore back in 2006, and it works beautifully. Now my question: Is there a way to continue using that string but have it start from a certain row? Columns(1).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
View 2 Replies
View Related
Mar 27, 2007
attached is a spreadsheet effectively replicating a criteria box I’m using to do an advanced filter on a large amount of data (5000+ lines). The criteria can be anywhere from 1 to 7 different lines. What I’m trying to achieve is code that will look at the specified criteria box, determine how many rows of criteria actually exist, and then use that code to perform the advanced filter function on the data.
Below is the code I’ve put together so far. The problem is that this code can only determine that there are 7 total rows of criteria to use, and not the exact number of rows of criteria. For instance, say I only wanted to use 2 rows of criteria, I’m hoping the macro would only use those 2 rows instead of picking up all 7 rows.
See criteria box on spreadsheet for example. In this particular example, I’m wanting the macro to only use B49:I51 as criteria. The ideal solution would be for the macro to look at the criteria box and determine the last row used that is not filled with “1”s. Does anybody have any thoughts on ways to tweak my code to get it to achieve this?
Sub RunDynamicSelection_Click()
Dim wsSheetDS As Worksheet
Dim wsSheetRS
Set wsSheetDS = Worksheets("DataSheet")
Set wsSheetRS = Worksheets("ReportSelection")
With wsSheetDS
.AutoFilterMode = False
With wsSheetDS. Range(("A4:N4"), wsSheetDS.UsedRange.Rows(Worksheets("DataSheet") _
.UsedRange.Rows.Count)).AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _....................
View 2 Replies
View Related
Feb 20, 2014
I'm new to creating macros and trying to create a macro that will perform a formula that I can use for multiple files. However the files are a varying number of rows.
I want the formula to carry out on the entire column (all rows). However when I record the macro (I tried using relative and also tried using absolute references when filling the formula) the formula always seems to stop filling wherever my original file's rows stopped. I wrote the formula for the first row and double clicked it to fill the remaining rows.
For example if the macro I recorded in File 1 goes to row 15, when I run the macro on File 2 which is 20 rows, the formula stops filling at row 15.
View 8 Replies
View Related
Dec 1, 2008
writing a VBA to convert a set of data in sheet 1 to one in sheet 2(I am enclosing that as a Excel document"Test -Original").I have described what needs to be done ( step by step ) below.
Develop a macro
1. I have a report from SAP BW, the original format of which is in sheet 1.I need to develop a macro using VBA and need the report with the format in sheet 2.
2. I need a “Results “row after every Bill to Party in column A as below(screen shot 1.doc):
The number of customers is dynamic i.e.it keeps changing every month
4. Nothing needs to be done to column.SAP BW will not overwrite the format and the data in column G.Hence leave it as it is.
5. Calculate the number of Sales document numbers for each customer and put the value of 1 for every value. If it is blank it should not be counted and put the value of 0 for those rows. (Shown below) Display the sum of the number of sales document numbers in the results row for column H
6. In the column I, put the value of 1 if the difference column (column G) is 0 and put the value of 0 if the value in the difference column (column G) is any value apart from 0.now sum the value in the results row for each customer and display the summation value in the results row under column I
7. Compute the percentage which is the values in (column I/Column J)*100 .This should be done only for the results row
View 9 Replies
View Related