Limit of 50 =importData functions per sheet - workaround? - excel

In a sheet of mine I used 50 importData functions to shorten links via bit.ly automatically. Unfortunately, there is a limit of 50 functions per sheet which doesn't allow me to add more functions.
I don't want to open up more and more sheets, because that would be messy long term. Do you have recommendations for a workaround?

Create a custom function and put this to get the contents of your url:
var info = UrlFetchApp.fetch("yourURL");
Process the info and return it.
You might need to use
Utilities.sleep(1000);
...between the calls in order to get a value for every cell.

Related

How do you create a progress bar in excel VBA without having your steps in a loop?

I'm extremely new to VB. I've managed to put together a form that gives users the option to pick from 10 different checkboxes (all or any combination) that will run a query against our database and bring back the results into an excel worksheet (a separate worksheet for each option). Basically in my submit button code, the code says If ckboxA = True Then Call query A End If, If ckboxB = True Then Call query B End If, etc...(Each of my queries is a separate Sub in 1 Module - not sure that's important, but just in case).
Some of the queries are really quick while others take some time, I want to provide a progress bar so that the user knows the process is running and gets an idea of progress being made. I've watched video after video, but they all involve a loop where the same thing is being done over and over so the progress is pretty easily measured. How do I do this in my situation, can I add something in my "If" statement for each of the options?

Can Excel 2013 print different PrintTitleRows to each page?

I may be trying to do the impossible. What I need is to dynamically set the PrintTitleRows for each printed page in Excel. My worksheet is created dynamically and there are multiple (yet similar) sections of different row lengths and I want to show the section name and description titles on the top of the following page if the section overflows to multiple pages. The section names will not always be the same though the column titles will. The section name is on the row above the description titles.
Section name and description titles
Currently, I am calling my PageSettings sub and then executing the ExportAsFixedFormat, so I am guessing this can't be done.
I have spent the last few hours searching the Microsoft site, Stackoverflow.com and the web in general with no questions or hits related to this question.
Thanks in advance for any insight you may have.
The answer in no and is based on my experience. The PrintTitleRows and PrintTitleColumns are a one time setting which I did in my PageSettings sub. Once ExportAsFixedFormat starts running, it never hits the PageSettings sub again.
PrintTitleRows is a one time setting that places the same row (or rows) at the top of every printed page but I needed different rows.
The best I found way to achieve this is to add the necessary rows to the worksheet after each page break to make the report look the way I want when printed. I then hide these header rows from the user and display them when I print.

vba Handling error when multiple users are using cell value in procedure

Excuse me if I am asking already handled problem.
I am trying to automate the invoicing of our company.
We have an excel workbook with all the information about the clients, monthly payments and etc. I ve made the system and it works great. I even sent email with specific text and the invoice attached.
The problem comes when multiple users are using the system, so the invoice numbers duplicate.
Invoice number is stored in the excel workbook and after every invoice it becomes + 1.
The system works like this:
Login form - login with username.
The macro copies from the master table/modified protected/ only the info for the users clients and paste it into new wb template. The user checks the info, approves it and clicks send button.
Then the macro make the invoices using the number from the first wb and send the email to the client.
Do you have any tips how to protect the invoice number cell when someone is using the macro? I was thinking of making a list of users and when someone logs in his variable becomes 1, so if the sum of all users is greater than 1 you cant issue an invoice. But thats lame.
Hope there is a way like- when busy .....
But how can user 2 know that user1 is issuing.
Appreciate if you can help.
I'm not entirely clear on the exact process you're using to get the invoice number here, but it sounds like the number is being retrieved from another sheet and then incremented by one, correct?
If so, the best option might be to record each invoice as you go - as soon as the macro grabs an invoice number, it records a new line of data with the new invoice number on it. That way the next person to use the macro, even if it's only seconds later, would get the next number in the sequence, rather than the same number. The process would be something like:
lngLast = wbkOtherWorkbook.range("A" & rows.count).end(xlup).row
lngInvoiceNum = wbkOtherWorkbook.range("A" & lnglast).value +1
wbkOtherWorkbook.range("A" & lnglast+1).value = lngInvoiceNum
I'd imagine you'll want to keep a list of all your invoices somewhere anyway - just include this step in the recording process.
thank you guys, i ll try to explain better. So only I can edit the master table, everybody is opening a read only copy of the wb. The invoices after issued are saved in the coresponding folder - one for each client. The number for the invoice is the tricky part.
Today I made two possible solutions:
1. I made a function, when someone is issuing, first his own macro counts the invoices he is going to make. Then opens different /third wb/ with the invoice number, takes the value and adds the invoices count which will be made. So I only lose 1 sec or something. Also made a loop while isworkbookopen(numberInvoice)=true do events wend.
This way the number is always correct.
2. The other option I havent tested yet is sharing the trird wb /numberInvoice/ so anyone can use and manipulate it simultaniously. Dont understand if sharing a wb is going to work, but thats diffrent topic.
So I am going to take Ralph advice and I am looking forward to learn some Access database stuff. Wish you all the best!
P.S. working with vba for like a month or two, so Im kind a newb. Thank you for understanding.

Remove a button in SuiteScript

I need to be able to remove the delete button when today is greater than a particular calculated date.
There are 2 ideas I had and issues with each:
1 - Set a custom field on the record for the particular calculated date. Then use a workflow action of Remove Button where the custom field is <= today. My issue is I am wondering if there is a way to get "today" because I expected the condition to change allowing me to do that. I tried to use a formula and can't find Now() as a valid function listed.
2 - Workflow are truly scripts in the background. That means the Remove Button should be available in API. Therefore, my idea was to do my conditioning in suite script and then call this function. However, this function also does not exist in supported form. Has anyone hacked this to find what the function that is called in Remove Button is?
If we can get either idea to work, or if you have a third I haven't thought of that accomplishes the same task, that would be great.
I figured out my own answer. In case someone else ever needs this (as I didn't see anything like this on stack overflow), here is how to do option #1:
Save the value to a custom field - custbody_block_dlt_date
In a workflow, use the Remove Button function and use a formula condition
The condition is: {custbody_block_dlt_date} < sysdate
"sysdate" is the way you can get "Now()" or "today" in the condition
An alternative could be to create a User Event Script, on the before load function, get the button object then use the .setVisible(visible) method to hide it based on a date criteria, you may also want to set other restrictions based on roles that allow certain individuals to still be able to delete the record, like high positioned accountants. That avoids creating unnecessary fields on your records, while still providing the functionality that you desire. This could easily be done in < 4 lines of JavaScript.
See nlobjButton for examples.

How do you Calculate Multiple Pages to a Grand Total in LiveCycle?

I am not a programmer but I have to create an expense form for traveling. It has to be in PDF format (preferably Adobe Acrobat editable). I created the form with Excel and exported it to Adobe but, of course, the formulas do not transfer.
I have 3 pages that are identical for calculating travel expenses with the only difference being there is one extra cell on the first page that calculates totals from each page to a grand total. Sounds easy. All the pages calculate individually with no problem but I cannot reference the totals from the individual pages to the first page where the grand total is.
I am using Adobe LiveCycle because it "simplifies" the programming process for people like me. It has worked great so far but this is the only thing problem I am having and the only thing holding me from using the form.
All three pages are in the same document. When I use FormCalc for the totals within each page, it works great:
topmostSubform.Page1.P1TotalGrand::calculate - (FormCalc, client)
$=P1MileageTotal+P1TransAirTotal+P1CarRenTotal+P1HotelTotal+P1AllowTotal+P1PhoneTotal+P1MIETotal+P1BusMealTotal+P1OtherTotal
If I go to the next page, it looks like this:
topmostSubform.Page2.P1TotalGrand::calculate - (FormCalc, client)
$=P1MileageTotal+P1TransAirTotal+P1CarRenTotal+P1HotelTotal+P1AllowTotal+P1PhoneTotal+P1MIETotal+P1BusMealTotal+P1OtherTotal
I just want to be able to add them together. When I try, it doesn't recognize the 2nd page and I don't know why. The form is pretty basic and I would really appreciate any help. If you need any additional information, I'll be glad to oblige.
I believe you can do it. There should be many ways and I am a newbie too so here are two ways...
If you want grand total of 2 pages - does not matter on which page you want it, the formula should be like
topmostSubform.Page1.P1GREATTotalGrand::calculate - (FormCalc, client)
$=P1TotalGrand+P2TotalGrand
The trick is to select both by press and hold Ctrl Key, then select the field you want to select rather then type in. this should solve the problem.
If you want the total to be at page one.
Make the P2GreatTotalGrand to be a global data and create the same data field on page one and add this new one and one already on page one to get the grand total on page one.

Resources