Grouping and colouring each grouping in excel 2013 - vba

can you tell me how I can group rows using a value in a specific cell and then highlight the individual groups by alternate colours i.e. one group with white background and one group with a colour in excel? I have macro code which inserts a blank line but I don't know how to colour using macro.

You don't need a macro, just run conditional formatting for values equal to the value of the group you are using.
Here is an excellent guide for how to highlight a row using conditional formatting. It does exactly what you asked for without having to write any code. As you can see it works for multiple rows sharing the common set value.
This is assuming that the only reason you wanted them grouped in the first place was for colouring them together, this method is best if you want to preserve the order of your data.

Related

How to use vba to filer a column using value from a specific cell

I want to use a macro to filter columns in a table. I want to filter for values that are higher than a value I want to put in cell, to be able to easily change the filter. Does someone have a trick for doing this with vba?
Many thanks, Bram
Record a macro whilst filtering a table on a column value. You would right click on the table column header of interest whilst recording the code and select Number_Filters > Greater Than and enter your desired number. That would give you the outline code. You can then amend the code to pick up the desired value from a specified cell. If applying filter to multiple columns record macro whilst doing this process over several columns.
Thank you for you answer. I tried this already, but I could not get the macro to pick from a specific cell. If I stored the value of the specific cell under as 'value' and put that in the outlined code, it would just do Greater Than value.. DO you have shortcut for this?
Thanks!

Dynamic Row Shading with Conditional Formatting Formulas - EXCEL

I have a document with functionality via data validation selection. Each selection triggers a macro to hide certain rows. I have the following conditional formatting formula =MOD(ROW(),2)=1 and it works great when all rows are unhidden, however I'm looking for a more dynamic formula that can change when the rows are automatically hidden. I'm open to using VBA in lieu of conditional formatting.
You can use SUBTOTAL to count non-hidden rows. This relies on a column being filled (ie no blanks). I've used column A, use a different one if you need to.
Conditional Format formula
=MOD(SUBTOTAL(103,A1:$A$1),2)=1

Merge Cells option is not available for columns

I have created one SSRS report. While trying to merge 2 cells on the top Right most corner the option seems to be unavailable. Why it happened so? Is there any idea to make it available.Here is my snapshot of table and grouping. The highlighted columns need to merged.
If I'm understanding you correctly, you're attempting to merge a cell that's within a column grouping to a cell that's outside that group (I.E. the top left one)? That won't work - the cell inside the group can potentially generate multiple columns in the rendered table, so Report Builder won't allow you to merge it with another cell that isn't within the same group.
You could perhaps simply remove/hide that top row and instead place a text box above the table containing your expression? You'll need to consider the size of it carefully to make sure it doesn't look out of place though.
You can delete the group column but keep the group. Insert a column within the group, use the column as your Project Name, then you can merge the cell.

How to make rows invisible while printing reports?

I am using an .rldc file to define the layout of the reports from my program. The problem is, it is to be used for incremental printing. That means the paper will be used over and over as newer rows need to be printed. I'm attempting to approach it this way:
List all corresponding data on the report view.
Make the older rows invisible and only show the latest row.
Print.
That way, the last row is already properly placed. The problem is, I don't know how to implement this. Can anyone help me out?
You could create an IIF(condition,true,false) statement in your report definition on the row visibility variable.
The best way i guess is to define in your data source something of a rank column.
example :
select col1,col2,col3,RANK() OVER (ORDER BY col3 DESC) AS 'rank' from table1
Then in your table or matrix, you click on the row or/and column that you want to make the borders and text white based on a expression.
Go to the properties and dropdown on bordercolor
choose expression and type in (based on my example query)
=IIf(rank.value <> max(rank.value),White,Black)
That will not remove the rows only make the borders white ( unvisible)
The same you can do with Font Color property.
I think this is your best shot at this issue.
Other solution I could think of is to just hide unneccesary rows (which also replaces the visible row)
Then to move the table down by using a expression with a formula like nr of rows hidden before the actual row * height of 1 row, only I m not sure if this is applicable without programming an RDL extension..
Good Luck !

Formatting row by row with conditional formatting in Excel

Let's say I have 2 columns that I'm comparing data in. If both cells match I want both cells to turn green. If they don't match I want them to turn yellow. Is there a formula that will allow me to check this for multiple records, or would this require looping in VBA? I can only seem to make this work 1 record at a time using conditional formatting. Thanks!
Edit: Adding results from provided answer
You can use conditional formatting, but you'll have to format each of the two columns separately.
Say your data is in A2:B100 (for simplicity)
Select the cells in columnA (A2:A100)
Select conditional Formatting >> New Rule >> Use a formula...
Enter the formula "=A3<>B3", choose a format and click OK
Repeat on column B.