I have some conditional formatting styles. I don't want to keep creating new rules for new ranges; I would rather follow DRY by declaring it once and referencing it elsewhere. I'm having difficulty doing this.
The conditional formatting rule works fine when it's just one range.
=Travel!$C$5:$P$8
However, I then try to add another range on another sheet, and it fails.
=Travel!$C$5:$P$8,Equipment!$B$5:$H$11
When I click "Apply", nothing happens on the spreadsheet, and the range for the rule in question resets itself to this:
=Travel!$C$5:$P$8
Is there a way to do this?
The same rule cannot apply to 2 different sheets at the same time. You'll have to create a separate rule for the Equipment sheet. I tried on a whim to create a named range that covered cells on 2 different sheets, then tried using that named range as the applies to range, but no luck.
Related
I am converting a macro from VBA in excel to script in google sheets and there's a part where I have specified the ranges to select.
VBA macro screenshot
The cells being named within the macro are formulated to specify a range that will change based on how many cells have data and are relevant.
Formula example
I've figured out the named range element of sheets, but it doesn't help me within the script or when manually recording. I've recorded the rest of the Macro I need but as the ranges vary every time it is used, I need a way of using these variable cells to make sure the correct parts are copied across.
I thought maybe something similar to excels range(range) type of thing might work, but being a self taught VBA user, now. emigrating to sheets is proving a pain in the b...
Hope this makes sense and someone can help.
Thanks in advance
Select a range from a string in the active cell.
function getRangeFromActiveCell() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getActiveSheet();
sh.getRange(sh.getRange('G3').getDisplayValue()).activate();
}
Active Cell Selected
Range in Active Cell Selected
I have a table of contents in Excel 365. In the table, column 2 contains the names of worksheets and column 3 contains the names of tables and/or named ranges in the associated worksheet. I used the HYPERLINK function to link each cell to its specific component: hyperlinks for the worksheet column go to cell A1 on the associated worksheet; hyperlinks in the table/named range column go to that specific table or named range.
Since this results in several repeats of worksheet names, I used conditional formatting to change the text to white when the worksheet name is a repeat of the one directly above it. This makes it look more like an outline. It works like a charm up until the point that I click on the link in a repeated cell, making it a FollowedHyperlink. When I return to the table, this is no longer whited out. Is there a way to make these stay white, even after they've been followed?
Here's the formula I used for the conditional formatting rule applied it throughout the range =$C$6:$C$24:
=C5=C6
Here's what it looks like before I click one of the whited-out cells:
Here's what it looks like after I click one of the whited-out cells:
Urdearboy posted a link showing how to change the style of a followed link.
https://superuser.com/questions/728825/how-do-i-prevent-excel-from-changing-the-color-of-a-clicked-link/819931#819931
It is probably the best solution without using VBA.
But if you want some not control over it, if for example, you may want all links in a table if contents to be uniform color regardless if they were taken or not, but you want links in the rest of the book to change. That's as easy as a single line of VBA in the worksheet's SheetFollowHyperlink event:
Target.Range.Font.Color = vbBlue
And if you wanted to apply it to the entire workbook instead of a single sheet you would put it in the workbook's SheetFollowHyperlink event.
But if you want to be a little creative...
You could make the link disappear by blending it with the background color:
Target.Range.Font.Color = Target.Range.Interior.Color
Or you can draw attention to it, by changing the back color:
Target.Range.Interior.Color = vbYellow
Really, your imagination is the only limit. You can do just about anything you'd ever want to do ( and a lot more of things you would never want to do).
I have one excel file in which I have multiple sheets with financial statements from different companies (called Databas.xlsx). The structures of these sheets are identical. Then I have another excel file that I wish to use to analyse these financial statements using charts. Thus, I must get data from the different sheets into my analysis file. Doing this from one sheet is no problem, as I can simply create a chart and mark the data I need from this sheet, so that the chart data range would be something like this:
=[Databas.xlsx]Kopparbergs!$C$3:$K$3
where "Kopparbergs" is the sheet name in Databas.xlsx. The problem I am facing is that I want to be able to change the sheet name that is put into this formula by writing the name in a cell (because that would enable me to change multiple charts at once). So just to clarify, in the formula written above, I want to be able to change the word "Kopparbergs" by writing text in a cell. If that is not possible, how would I accomplish this? That is, how do you create a chart that can change its content depending on a text in a cell that corresponds to a sheet?
So rather than using Indirect I think you need to use two named ranges for referencing when using a Chart.
This previous answer looks like a good guide to implement (not sure about etiquette of just copy & pasting previous answers so I'll just provide the link):
Dynamic chart range using INDIRECT: That function is not valid (despite range highlighted)
I am really new to VBA. SO this might seem a silly question for experts.
after researching the internet on how to put dynamic range for filters in excel considering a situation when your list might grow or shrink I stumbled on couple of ways. One of them is as the following.
ActiveSheet.Range("A1").AutoFilter Field:=46, Criteria1:="1"
I know the you can put two arguments to specify ranges and the second one is optional. In this particular I am just putting the first cell where my data starts. My questions are below:
does the code automatically select the active range based on the first specified cell?
Had my data started from "C5" would i still have to chose the argument as "A1"?
I am filtering out something from column 46. what does it matter where I specify my first cell? for example if I had chosen "C5" instead of "A1" how it would have affected my macro?
Let's say, I want to filter out something from column 2 ie, Field 2. But the argument for range I choose as "D5". How it would affect my macro code?
AutoFilter: A Small Study
Well, I was curious, too. So I studied it a little bit and created a
workbook where you can input the parameters of some of the arguments
of the AutoFilter method and just by clicking on a command button
apply the changes. The next click removes the filter.
The workbook also contains the results of the behavior when changing
by row. The same thing could be done by column.
Workbook
Download
(Dropbox)
The following image displays the initial state of the only worksheet in the workbook.
This I was most curious about: what would happen if I would filter in C8. There's a surprise.
There still remains a ton of unanswered questions, but this could get you started to investigate deeper.
I'm using a spreadsheet to generate a series of game server configurations and using formulas to generate the commands. The tiers are broken down into separate sheets with a formula to generate the configuration command for what I want to modify regarding that tier. However, one sheet is a master list of all ~375 entity IDs that I want to highlight if they are entered on any other sheet in the document to make sure I have everything covered.
Any suggestions on this? I've tried using Vlookup and Countif, but I keep getting errors or not everything is properly highlighted
Let's say you have a master worksheet with a list of IDs you may use nested IFERROR function if other worksheets contain ID keys.
=IFERROR(IFERROR(MATCH(A2,Sheet2!A:A,0),MATCH(A2,Sheet3!A:A,0)),"No Match")
Something like this: