Power Automate - Update last row in an Excel table - excel

I currently use an Excel spreadsheet to store all users 4 digit printer code. This 4 digit code is incremental so when a new user joins our team, their code will be 1 digit higher than the previous user who joined, e.g. previous user code 1122, new user code 1123.
printer codes sheet
What I'm trying to do is:
Submit a form via MS forms with the basic details of the new user. The flow then adds the information from the form and adds it to the printer code excel sheet.
The flow will grab the printer code of the previous user above and raise the value by 1 and assign it to the new user added.
For the most part this process is working as intended. Where is it failing is the flow isn't grabbing the code from the previous user, but the code 250 rows earlier.
Please see my flow below:
Getting form details and listing rows in table
I then use 2 compose actions to grab the last row in the table and then update the value by 1:
grab last row
add + 1
The information from the form is then added to the spreadsheet table, using output 2 as the content for the Code column.
Add row
From what I can gather the problem is my first compose formula, as the incremental compose is adding +1, but not to the row above.
compose input/output
compose 2 input/output
The code the flow grabbed was 1388 as it will add the code 1389. But the last user added is 1641 so the new user should have a code of 1642.
If anyone knows what I am doing wrong and could share it would be greatly appreciated.
Thank you.

You can try this to get the row with the highest value in column “Code”:

Related

Create a random number when a new Form is submitted

I have created a Microsoft form for Purchase Order Requests, when someone submits the form I would like the table on the excel worksheet to create a purchase order number, I am using a combination of sequential and random numbers to create this number.
My problem is that every time a new form is submitted and the worksheet is updated all of the random numbers are recalculated changing the purchase order numbers of other submissions.
Is there a way I can have the formula only calculate when there is a new row added to the table(a new form submission) or any ideas how I can create this number within the Microsoft Form?
I have tried using the Excel online script to create the random number and it's triggered by Power automate flow but I keep getting failed flow runs, and I can't have any failed flow runs at anytime.
Thanks for your help

Use userform to search for unique identifier and update

I have information entered into a spreadsheet using a user form, each row has a unique user id and a bunch of data and pre-labeled empty columns for future updated information.
I have created another user form that I want to use to update empty columns in the rows as required. I want to be able to enter the unique id into a text box and updated information to populate blank columns into other relevant text boxes and when I hit edit it searches for the relevant unique id and puts the information into the relevant columns of that row.
I do have the clear and close buttons working.
update form.
This is my sample spreadsheet, with empty columns to be populated when updating
sample spreadsheet
And the information currently entered into the spreadsheet is entered by this user form.
enter information
I had previously found something like this on this site, but now cannot find it.
I am super new to this and would not know where to start to create my own cod
Add here the excel sheet sample to see the table structure. The userform for updating records is in the same sheet as the data?

How to use mailmerge macro from excel to word with a click of a button in the excel sheet

I am trying to create a code which will be executed with a click of a button in the excel sheet and will ask me for an input of a cell value in excel which will then take all the data from that cell's row and insert it accordingly in the word template where the mail merge tags are.
for example :
I have data like this in my excel sheet :
ID(A1), Name(B1), Last Name(C1), Country(D1), Date(E1)
378232625(A2), John(B2), Smith(C2), United States(D2), 29/02/2020(E2)
322783145(A3), Joshua(B3), Brand(C3), United States(D3), 27/02/2020(E3)
I want to have a button which will ask for an ID input and will then take all the other info of that person and place it in the word template in the correct place.
For example:
When a user runs the code it will pop up an input box and it will ask him to type an ID,
for example: 322783145
it will then check where the ID is placed(which row in A column) in the excel sheet which is A3 for this example and will pull the rest of this person's information into the word template I have created beforehand.(ID, Name, Last Name, Country and Date).
Later on I want to be able to automatically save it to pdf as well with the same button but first I want this to work.
Thanks in advance :D
You don't need VBA for this with the question as originally posted - simply use a SKIPIF field coded as:
{SKIPIF{MERGEFIELD ID}<> {FILLIN "Which ID do you want?" \o}}
or:
{SKIPIF«ID»<> {FILLIN "Which ID do you want?" \o}}
where 'ID' is the name of the data field in Excel you want to the merge to process.
With that, only the record containing that ID will be processed. No VBA required.
Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac or, if you’re using a laptop, you might need to use Ctrl-Fn-F9); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. Likewise, the chevrons (i.e. '« »') are part of the actual mergefields - which you can insert from the 'Insert Merge Field' dropdown (i.e. you can't type or copy & paste them from this message, either). The spaces represented in the field constructions are all required.
I see that you've added two new requirements, viz:
the mailmerge to be run from a button in Excel; and
for it "to be able to automatically save it to pdf as well".
You really shouldn't move the goal posts this way. Nor should you ask ask multiple distinct questions in the same thread. For code to run a merge from Excel (and send the output to PDF), see Run a Mailmerge from Excel, Sending the Output to Individual Files in the Mailmerge Tips & Tricks thread at: https://www.msofficeforums.com/mail-merge/21803-mailmerge-tips-tricks.html. Of course, once you get into using a macro such as this, you will need to add the logic for the ID selection to that code. Ask in a separate thread if you can't figure that out.

Click through multiple rows on a webpage in Blue Prism

I have run into an issue trying to retrieve data from a table on the surface of a web page. In each row of the table there is a link that leads to more details about the information in each row. See image The automation needs to decide whether or not to copy the row information based on criteria that is only given within the link.
Part of where I'm stuck is due to the fact that the number of rows in the table can vary, so I can't just specify each link as it's own element. So I need my bot to:
Start at the first row of information
Click the details link
Decide whether or not the information from the correlating row is needed
Go back to the place where the table is and copy down info if needed
Go to the next row and repeat steps 1-4 for the rest of the table
I believe I have a handle on step 3 and 4, along with 2 if clicking an element doesn't change with iterating through the table.
Thanks!
Just create a loop, that will iterate it self every time whenever you will go back to the table after copy info from the row.
So I would do something like that:
1.Click the details link
2.Decide whether or not the information from the correlating row is needed
3.Go back to the place where the table is and copy down info if needed
4.Go to the next row and repeat steps 1-4 for the rest of the table
5.Check if there is a next row. Yes? Loop to step 1. No? End.

Data entry user form, copy paste with variation data

I'm working on a user form in excel vba. The purpose of the user form is to make data entry more efficient. The data that is being entered is for shoe products. Basically a "parent" of the data is made in one row. The proceeding rows, or what I refer to as children/variations, have the exact same data except certain fields(columns) will be variations of the parent and each variation will have a unique identifier.
For example: say we're entering data for "shoe123". The parent data would be like this
Title Sku
Shoe123 S123
Then the children would be in the row underneath with the same data except the variation size will be tagged at the end of some fields as well as a unique identifier for each variation. Theyd look something like this.
Title Sku
Shoe123 10.5 s123 10.5
Shoe123 11 s123 11
Uniqueid
09876543311
09876543321
So at this point I have been able to enter all the parent data in the form and transfer it to the appropriate column. I'm trying to figure out two things.
How can I code the user form to allow the user to enter the number of variations to create? and then based on the number the user enters, populate that number of combo boxes with pre filled size selections with text boxes next to each combo box to enter the unique identifier?
How would I copy and paste all the parent data with the variation data for each size selected as well as the unique identifier for each variation?
so far I'm thinking I'll need to use arrays for the copy and paste part. I just need some direction. Any help is greatly appreciated!
Thanks Everyone
I understand from your question that you are trying to create a database. If this is correct I would advice you to try and create this in Access. In Access it is a lot easier to link parent data to children. It will also safe you all the time you would need in Excel to code the userforms, etc. as this is (almost) use-ready provided in Access.
If you are determined to create this in Excel, perhaps you could show the vba-code you have so far?

Resources