activate a worksheet by name in a list - worksheet

Each of my worksheets represents a Project
In the first worksheet ("Select Project") I have created a list that contains all worksheets names (Cells A3:A50)
In a specific cell( E4), in this worksheet, I select a project from the list
I wish to activate the worksheet with that name (of cell E4)

Add this code to your "Select Project" VBA module:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("E4")) Is Nothing Then
Dim projectName As Variant
projectName = [E4]
Sheets(projectName).Activate
End If
End Sub
This event handler (triggered when any value in your "Select Project" sheet is changed) will check if it was the cell E4, which was changed and if so, it activates the sheet based on the value in this cell.

Related

Get Select list Item value in IG report column for DML operation

I have a Select list filter on the top of the page. I want its return value to get into any column which I create in IG report automatic DML process.
Suppose, Select list has a value "Step", when I add a row in IG report, that value should be saved into DB for one column which is hidden on UI.
I tried but sometimes it stores the value which I selected in Select list item as my last selection not the current one. Do I need to create Application item for this? Please help. TIA
In this case there is a table ig_tickes with a status column. On the page there is a page item P131_STATUS (select list) with values "OPEN" and "CLOSED". There is an interactive grid on table ig_tickets with column STATUS hidden. Functionality is that user selects a value from the select list and then clicks "Add Row".
Give the interactive grid a static id of "tickets"
Create a dynamic action on change of P131_STATUS with a true action of type "execute javascript code" and code:
var model = apex.region("tickets").call("getViews").grid.model;
model.getOption("fields").STATUS.defaultValue = apex.item( "P131_STATUS" ).getValue();
That's all there is to it.

How to display multiple data selected in LOV to Textbox | Oracle APEX |

I have a scenario where I am stuck not getting how do I proceed with it.
Created a LOV -> which holds below values
A-A
A-B
A-C
A-D
I have set the property of LOV item -> Multiple and Separator given : ,
When I select 1st, 2nd & 4th value it should be automatically displayed in my textbox in comma separated format like following : A-A,A-B,A-D
Any solution is much appreciated !!!
Suppose you have a select list item named P92_LOV and a text field page item named P92_TEXTFIELD.
Create a dynamic action on change of P92_LOV
Add a true action
Identification > Action: Set Value
Settings > Set Type: PL/SQL Function Body
Settings > PL/SQL Function Body:
RETURN :P92_LOV;
Settings > Items to Submit: P92_LOV
Affected Elements > Selection Type: Item(s)
Affected Elements > Items(s): P92_TEXTFIELD
Try it out, whenever you select/unselect a value in the select list, the value in the checkbox will change accordingly.

Change value of a single cell in Power BI

I am trying to change the value of a single cell in power bi. When I go into the "data" view then right click and then go to "edit query" I have the option for "replace values". This works like a find and replace, the issue I am having is that if there are multiple cells with the same values they will all get changed. How can I just edit a single cell??
Unfortunately it is not as easy as just editing the cell. If you do not have an index/id column in your table then add one (there is a button on the toolbar to do this).
Then create a new custom column in M (PowerQuery / the data prep language of PowerBI), along the lines of:
NewColumn = IF ([Index] = "Index Number" and [YourColumn] = "<your value>")
THEN "The new text"
ELSE [YourOriginalColumn]
Rename or remove the original column and rename NewColumn to the original column name.

Excel Macro for data validation modification

In cell A5, a list validation is populated ( Cat A, Cat B and Cat C). When the user choose category A, cell C5 is populated by a formula that tells the user to fill in the cell. Once the user goes to Cell C5, there is no formula but a drop down or a list validation of (yes or no).
If the user then goes back to cell A5 and chooses category C, cell C5 will be populated the original formula that cell the user to again the cell. Once the user goes to cell C5, there again no formula but a drop down or a list validation (yes/no)
Is it possible to write a simple macro for this? Anyone please? Thank you so much.
I think I know how but need more thoughts.
This is pretty simple code, but not easy to figure out if you haven't written VBA before. It will require two subroutines. In your VBE double click on the worksheet in the "Project - VBAProject" pane where you want this to live. Mine is being built for workbook "Book1.xls" in the tab "Sheet1"
We are going to use subroutines based on worksheet events. Events are things that happen on the front end (like selecting a cell) that fire code in VBA.
SelectionChange - This worksheet event fires whenever a user changes cell/range selections. We will use it to detect if the user switched to cell C5
Change - This worksheet event fires when someone Changes a cell's value. We use it to see if A5 was changed
In the code editor pane in your VBE, place the following:
Private Sub Worksheet_Change(ByVal Target As Range)
'This subroutine fires when a cell value changes in this worksheet.
'did someone change something specifically in cell A5?
If Not Intersect(Target, Sheet1.Range("A5")) Is Nothing Then
'Is the value A or C?
If Sheet1.Range("A5").Value = "A" Or Sheet1.Range("A5").Value = "C" Then
'Remove any data validation for this cell:
Sheet1.Range("C5").Validation.Delete
'and change the value of C5 to "Fill in this cell"
Sheet1.Range("C5").Value = "Fill in this cell"
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'This subroutine fires when a user selects a different cell or range.
'So... it fires ALL The time so the next line is super important.
'Did someone change selection specifically to cell C5?
If Not Intersect(Target, Sheet1.Range("C5")) Is Nothing Then
'Is the value currently "Fill in this cell"?
If Sheet1.Range("C5").Value = "Fill in this cell" Then
'Empty the cell
Sheet1.Range("C5").Value = ""
'Add data validation to some list somewhere
With Sheet1.Range("C5").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$J$1:$J$4" 'This the range that the list exists in
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
End If
End Sub
I've noted the important stuff with comments. You'll probably need to monkey a bit with it to fit your needs. Most notably that cell validation code. Currently the data validation for C5 is set to J1:J4. Change that to fit your needs.

Oracle Apex - Select list populates text field

I'm using Oracle Apex 4.2. I have a select list and a text field. I'm trying to create a dynamic action that should be simple enough but I'm not sure how to do it. Basically depending on what value the user selects from the list of values in the select list, the text field should then be populated. So for example:
Let's say the select list gives the user the choice to select 'Animal', 'Car', 'Person'. If the user selects 'Animal' then the text field should immediately have the value 'cat'. If the user selects 'Car' then the text field should immediately have the value 'toyota'. If the user selects 'Person# then the text field should immediately have the value 'jim' etc.
How would I make this dynamic action?
Thanks,
Stephen.
Create a New Dynamic Action with the following properties
Main Properties
Event: Change
Selection Type: Item
Item(s): [Select List]
Condition: No Condition
True Action
Action: Execute PL/SQL code
Fire When event Result is: True
PL/SQL Code:
Option 1 - use a lookup table
select LOOKUP_VALUE
into :P1_TEXT
from LOOKUP_TABLE
where original_value = :P1_SELECT_LIST;
Option 2 - Use hardcoded values
CASE upper(:P1_SELECT_LIST)
WHEN 'ANIMAL' THEN :P1_TEXT := 'cat';
WHEN 'CAR' THEN :P1_TEXT := 'toyota';
WHEN 'PERSON' THEN :P1_TEXT := 'jim';
ELSE :P1_TEXT := null;
END CASE;
Page Items to Submit: [P1_SELECT_LIST]
Page Items to Return [P1_TEXT]