At work, I've been tasked with fixing a horrible spreadsheet they have been using for many years. What I'm looking for is a solution to allow me to print (in duplex, some time after the basic program is working) the same spreadsheet, but update the date before printing the next one. If this project was in C or C++ I could handle it but using the Excel sheet is making it impossible for me. I've been searching for days upon end and can't get anything to work. I do not care what specific language, I just don't know anything about MS office programming. Any suggestions?
Example:
Spreadsheet is called "LC" in workbook LCWB.XLS
in pseudocode I'm looking for:
A button or input that will allow me to select 10 12 14 weeks, and store that number * 7 to provide days in a variable we will call X.
There will also be the "beginning date" stored in a cell "A1"
The date is supplied to the program to update the date at every iteration, until there are 70 pages with consecutive dates on them.
Then a loop
while count <= X
print excel worksheet LC
update "date cell"="date cell" + 1
Does not need to save anything, I hope this makes sense, if not, I will upload part of the actual sheet. I'd really like to figure this out in part on my own to learn, but I'm so confused.
Like I previously mentioned, the language doesn't matter. VBA in Excel, VB, VC#... The computer running this has Win XP SP3 and Office 2007.
Why are you needing to print the sheet out if nothing on the sheet changes but the dates?
I'm a print provider and would refer to this as a variable data printing project. Personally (knowing design software) I would put all the dates into a CSV file and then put the rest of the documents content in InDesign. Alternatively you may be able to use M$ Word's mail merge feature... Anyhow have a field in the document (like a form letter) that pulls the dates from the CSV file. Word or InDesign will generate the multi-page file for you to print with the dates inserted where that field was.
Related
tl;dr: Is there a way to have multiple (10+) excel Macro workbooks run the same project from a single location so that if I need to fix a bug, I don't need to fix it in every single workbook?
Long version:
My company uses excel workbooks for engineering charts. Any changes are formatted as bold and highlighted gray. We then have a revision "table" at the bottom (I say "table" because it's just some merged cells - there doesn't seem to be a way to make a separate table that doesn't follow the column sizing for the rest of the workbook, but that's a question for another day).
When we do a new revision, we have to first clear any formatting from the previous revision, make our changes (and format them), then insert a row to the revision "table", then unformat the previous revision entry and reformat our new revision entry. Then, we export the workbook as a PDF which we name according to our print naming format. However, it is easy to make mistakes when doing this because the file name must be manually entered according to the format.
To make this process less tedious/error-prone, I wrote a VB macro program to automate the above steps, among other things. It works great, and will be implemented on our charts company wide.
However, I can only do so much testing on my own - there are bound to be things I missed or can do more efficiently (I'm an engineer, not a professional programmer). And we have dozens of engineering chart spreadsheets. If we implement this and then I discover I need to fix a bug or make an improvement to part of the program, I don't want to have to fix it in every single workbook - that would take way too long and be too easy to miss a workbook!
Any advice would be appreciated.
I am currently writing a program in windows forms with vb.net and an SQL back end. The program is taking customer created Engineering Change Orders, Bill of Material updates, and recreating a custom template that we upload to our Oracle system to create the BOM changes. The customer sends us an excel spreadsheet with the updated BOMs. Items added to the BOM appear in red text and items being removed from the BOM are in red text with a strike through the text. My program is reading down the excel column and adding the item numbers to an SQL table that holds all the new BOMs. My problem is the removed items, items that appear in red with a strikethrough the text, are also being added. I need a way to detect if the font has a strike through so that I can stop them from being added to the SQL table. However, I can't find any way to detect text formatting on the excel sheet. I know you can detect text formatting with VBA inside of an excel macro but I can't find anything on how to do this with VB.NET on windows forms apps.
I thought the code would look something like this however "Characters" is not a legitimate option here.
If xlworksheet.cells(1,1).characters.font.strikethrough = true then
next
end if
Is there anyway to detect text formatting options like strikethrough with VB.NET inside windows forms.
We can use excel interop to do this. We can look for Font.Strikethrough. The following code worked for me.
Dim range as excel.Range = xlworksheet.cells(1,1)
If range.Font.Strikethrough = true then
'Strike through detected, do something
else
'No strike through detected, do something else
End If
The above code looked at the excel cell (1,1) or A1 and checked to see if it had a strike through or not. I confirmed this solution by applying a strikethrough in text on this cell and resaving the file and running the code again without a strike through.
I've got a collection of about 40 Excel worksheets. They store information about the number of hours that people have spent working on different projects, with dates across the top row from left to right and project names down the first column. Each member of the team has their own separate worksheet.
I'm making a new worksheet that will add up the number of hours each person has spent on a specific project.
I'm using this formula to add up all the numbers in a particular range of a linked file:
SUM(INDEX('S:\path\to\folder[Username_2017.xlsx]Daily'!G:JG,JOB_ROW,0))
JOB_ROW is the row containing the numbers I want to add up. Columns G:JG cover 1 Jan - 31 Dec. Username_2017.xlsx is different for each of the 40 people.
The problem is that the formula only works if I create it by hand. I can't find any way to use a dynamic reference to the filename, which gets very tedious with 40+ files to reference. I thought this might work:
SUM(INDEX(INDIRECT(C3),JOB_ROW,0))
...where C3, C4, C5 etc. would contain automatically-generated filenames and references. But it doesn't work. I get #REF!. And Excel doesn't prompt me to link the files -- which suggests to me that it will never work this way.
I've also found that even when the spreadsheet is working properly with the manually-entered formulae, if I save it and re-open it then Excel tries to be helpful by stripping out the formulas and replacing them with the text #REF!.
Is it possible to do what I'm trying to do? Or do I need to learn some VBA?
I should point out that I've largely avoided using Excel in my career so far -- so if there's a better way to achieve this then I'd love to hear it.
Thanks in advance for your help.
ian0411 gave the simple answer to this question in the comments above: the answer is "you can't do that".
If he wants to post that then I'll accept it as an answer -- but for the benefit of anyone else reading this question and looking for alternative options, here's what I tried and what worked:
VBA
I wrote some very simple VBA using GetObject() to open and read from each of the workbooks. It worked, but a) it was very slow, and b) it seemed to keep all the files open as long as Excel was running, which caused other problems. It also crashed a lot.
I gave up on VBA.
Automating the filename replacement
The next option I tried was to have a column of filenames in Excel, with a column next to it containing the formula that I wanted to run on each file. Instead of putting the linked filename in the formula, I put a unique placeholder ('XXXXX' or whatever).
Then I made a little macro that (for the currently selected row) did a search and replace across the row to change 'XXXXX' to the filename in column A. I had to run the macro 40 times to cover each file, but I only had to do that process once. When I add a new file to the list, I'll just add a new line, copy the formulas, and update the filename.
I've now got a spreadsheet which works perfectly when the linked files are closed, and which doesn't rely on VBA.
Perhaps if my VBA skills were better I could have written something less flaky -- but doing it all with INDEX() seems like the fastest, most elegant, and most reliable solution.
I have a presentation used for our new employee orientation that lists when specific forms are due. For example, Health Insurance form must be turned in 60 days from hire date. I would like the date to automatically update to be 60 days from the current date each time the presentation is ran.
I currently have a text box linked to an Excel spreadsheet which has a formula =NOW()+60. This works great, but it still does not update unless you first double click on the text box to activate/open the Excel spreadsheet, which then refreshes to the current date and updates the correct future date.
This is not a workable solution however because in the first place there are about 6 different instances (embedded in over 100 slides) of these future dates that need to be double clicked and updated, and in the second place, I am not running the presentation myself, but instead a subject matter expert is, who is NOT technically savvy enough to even double-click text boxes to force a refresh.
I am hoping find code that would either insert a future date automatically directly into the PowerPoint text box -or- open and refresh the linked Excel objects each time the PowerPoint is opened.
Any help would be appreciated, thanks.
If you have to doubleclick to get the formula to refresh, it seems likely that the spreadsheet is embedded, not linked. If you link the info instead, you'd only need to open the Excel file and save again to force the date to change, then open the PPT, which'd see the updated Excel file and update the links.
PPT will open/close Excel once per link; if you have lots of links, this can be quite time-consuming, but for six instances, I doubt it'd be bad.
This could also be done in code, but then you'd need to turn it the code into an add-in and install it on the end-user's PC to give them a one-click solution. If they can't be trusted to doubleclick the dates to update them, I'm not sure you'd want to teach them how to run macros embedded in the presentation itself. If creating an add-in is a possibility, give a shout and I'll make a couple suggestions on how you could do the coding.
I have an Excel document which makes a lot of calculations and shows the results in specific fields as text. I need to get these answers into PHP but Excel Reader can't read those fields, since they are the results of calculations.
So, I want to save the Excel document without the formulas/calculations, but with the results as text. How do i do this?
I'm stuck using Excel 2004 Mac btw.
edit: I forgot to mention: a client of mine has to upload a new version of this Excel document each day (the calculations change daily), so the simpler the solution the better. Also, there are too many values to change them all manually.
A finger dance worth remembering
ALT + E, S, V
To Paste Special (Values)
select all, then copy, then paste special as value
if this is need every day then you almost certainly want to record a macro that loops over very worksheet in the work book and does this