|
I'm about to pull my drat hair out. I absolutely cannot get Excel to talk to this MS SQL db. From Other Sources -> From SQL Server [DBNETLIB][ConnectionOpen (ParseConnectParams()).]Invalid Connection. //with server name as THESERVER.THEDOMAIN.ORG:PORT [DBNETILB][ConnectionOpen (connect()).]SQL Server does not exist or access denied //with server name as 10.20.30.40 with "User the following User Name and Password" checked I opened up wireshark to watch it, and it shows that excel is sending a bunch of SMB2 packets to the server. It also is sending my computer/domain logon to the sql server, which should obviously reject it. Yes, the "Use The Following Username/Password" is checked and filled in. I can use HeidiSQL, and it connects perfectly. Wireshark shows nothing but TCP/IP, and at no time is it blasting my not-sql credentials across the network. What's going on here?
|
# ? Jun 6, 2015 02:20 |
|
|
# ? May 11, 2024 05:51 |
|
ShimaTetsuo posted:In your original code, references to the Outlook namespace were late-bound (with CreateObject("Outlook.Application")). In your new code you also have some early-bound references (the first one that gave me an error was "Fld As MAPIFolder" in the declaration of "GetFolder"). When you have early-bound references you must add the library reference manually: in the "Tools" menu, under "References...", you want to include "Microsoft Outlook 12.0 Object Library".
|
# ? Jun 9, 2015 22:43 |
|
BOAs
|
# ? Jun 10, 2015 01:58 |
|
Is there any way of making the font colour in a text box reliant on the value in a cell? I've got a dashboard full of dynamic ones and I've now been asked to make them changeable to distinguish on/off target. It's in Excel 2010
|
# ? Jun 12, 2015 08:10 |
|
Total Meatlove posted:Is there any way of making the font colour in a text box reliant on the value in a cell? What you are looking for is "Conditional Formatting" Here are some tutorials: https://www.bing.com/videos/search?q=excel%202010%20conditional%20formatting
|
# ? Jun 12, 2015 15:59 |
|
Old James posted:What you are looking for is "Conditional Formatting" All formatting on the cell isn't reflected in the text box when it's dynamically linked.
|
# ? Jun 12, 2015 16:51 |
|
I just wanted to chime in to share some of the code I use on a daily basis since they might help someone with some of their one offs. They've been collected, created and edited many, many times over the last two years so I don't even know which fall into which category--if you recognize any of them feel free to call out the original creator. Locate position of the X instance of a character or word within a string: code:
Starting the timer code:
code:
code:
code:
code:
|
# ? Jun 12, 2015 17:21 |
|
FAN OF NICKELBACK posted:Create a timer to find out how long different sections of your code are actually taking: Doesn't Timer count the number of seconds since midnight? You'll get a weird result if your code execution crosses day boundaries (I do realize it's unlikely but your code does specifically do something for code that runs for more than 1 day so...). In any case, on Windows the best and most accurate way is to use QueryPerformanceCounter from kernel32. It's a bit complex but you can wrap it in a class like the one implemented in the answer here. I put this exact implementation in a "library" workbook and I've been using it for years, it works very well and is very similar to the built-in equivalent class in the .NET framework, System.Diagnostics.Stopwatch (you can also see at this link that Stopwatch is based on QPC as well). Edit: since it's not explained over at the SO answer, usage is like this: code:
ShimaTetsuo fucked around with this message at 00:20 on Jun 13, 2015 |
# ? Jun 13, 2015 00:13 |
|
You're absolutely right; I never gave it any thought / ran any code that took longer than 20 - 40 min to complete. Good callout.
|
# ? Jun 14, 2015 02:16 |
|
Total Meatlove posted:All formatting on the cell isn't reflected in the text box when it's dynamically linked. To try and explain this a little better. A4, A10 and A16 are dropdown boxes offering Red or Green. The boxes in B+C are dynamically linked text boxes, with the formula shown above. D+E is a Conditionally Formatted merged cell with the rules =$A$16="Green"/"Red" with the appropriate colour choice. If I change $A$16 to Green now on that book, D15 changes to show Example in Green. I just can't find out if having B15 behave the same way is possible, on a text box by text box basis, this sheet has around 30 individual ones with different requirements and target ratings.
|
# ? Jun 16, 2015 11:13 |
|
Can you skip the drop-downs and just set up targets (like I set up below in the screen shot), linking to the appropriate target setup matrix you create? It should work, unless you absolutely have to make it a manual switch, or there are text based values (though the core idea still works, provided I understand you correctly and you want multiple cells formatted based off shared values). I'm not 100% sure what you mean regarding the dynamic values causing you issue, however. Also, as a shortcut, you can set it up like pictured below--then simply select and drag the formatted cells one-at-a-time to wherever you like, keeping the data visually arranged as you prefer, but without having to code formatting independantly for each individual cell.
|
# ? Jun 16, 2015 17:48 |
|
[quote="FAN OF NICKELBACK" post="446658727" I'm not 100% sure what you mean regarding the dynamic values causing you issue, however. [/quote] I'm not explaining it clearly I think If you start with inserting a text box, then link that text box to a cell in the formula bar. That's what I mean by a dynamically linked text box.
|
# ? Jun 16, 2015 19:05 |
|
Total Meatlove posted:If you start with inserting a text box, then link that text box to a cell in the formula bar. That's what I mean by a dynamically linked text box. Well, I don't know of any nice way to do it, but you could hook up code that changes a TextBox's contents/formatting to the Workbook_SheetChange event? Like this: code:
|
# ? Jun 16, 2015 22:50 |
|
That works perfectly, and I've got it all mapped out nicely. I managed to get it working with the macro recorder and a little trial and error code:
Total Meatlove fucked around with this message at 11:26 on Jun 18, 2015 |
# ? Jun 17, 2015 07:31 |
|
What would the formula be to get a number based on a percentage? To clarify: I have a report for an email send, which shows TOTAL opens by recipients, and an OPEN RATE percentage. The Open Rate however, is based on UNIQUE opens, which is not shown. The Open Rate formula is [Unique Opens] / [Delivered Emails] So if 50 people opened an email which was sent to 100 recipients, it would have a 50% open rate. The email was delivered to 8,595 recipients. My report says 2,739 opens but the open rate is 22.33%. This percentage is based on the unique open rate, which is not shown. Based on these numbers, how would I get the unique opens?
|
# ? Jul 1, 2015 15:09 |
|
I feel like I'm missing something here but.... 8,595 delivered emails * 22.33% open rate = 1919 unique opens
|
# ? Jul 1, 2015 15:19 |
|
fosborb posted:I feel like I'm missing something here but.... I'm not very good at math Thank you.
|
# ? Jul 1, 2015 15:25 |
|
I have a column of data that looks like this:code:
I want to do two things: On the rows that have "weeks ago", put the words "weeks ago" in a column to the right on the same row. Second, I want to take the number from that row, multiply it by 7, and replace the original value. Somehow I was volunteered to do this even though I have almost no experience with excel.
|
# ? Jul 1, 2015 17:32 |
|
to extract the number and multiply by 7: =LEFT(A1,FIND(" ",A1)-1)*7 to extract the text: =RIGHT(A1,LEN(A1)-FIND(" ",A1))
|
# ? Jul 1, 2015 17:38 |
|
I want to make two charts from this data: One is a bar graph comparing the average response time for each problem code (S, G, H, etc.), and one is a pie chart showing what portion of the total time each code comprises. My Excel expertise is extremely limited, and I don't know how to limit sum or average calculations to the times associated with one particular code. Can anyone show me how to accomplish this? Thanks!
|
# ? Jul 2, 2015 20:18 |
|
You could just sort them by the problem code column and then calculate the mean/sum based on the row range of each code. Or you can select all that data, create a pivot table, and then calculate the mean/sum from that for each response type. Once you have that data, you can just go to insert chart and it should be pretty easy to create the bar chart and pie chart.
|
# ? Jul 2, 2015 21:09 |
|
Xandu posted:You could just sort them by the problem code column and then calculate the mean/sum based on the row range of each code. Looks like a pivot table is exactly what I need. Thanks!
|
# ? Jul 2, 2015 21:13 |
|
An important reminder: pie charts are bad. http://www.businessinsider.com/pie-charts-are-the-worst-2013-6
|
# ? Jul 2, 2015 22:42 |
|
I have a sheet that uses this function:code:
That currently produces this result: I'm trying to get the change this function so that it can VLOOKUP from the first table (TABLE4) if the "Channel" is odd, or CHOOSE from this table (TABLE5) if it's even, or N/A:
|
# ? Jul 3, 2015 11:42 |
|
I'm brand new to Excel VBA programming and I'm teaching myself through setting goals and trying to accomplish them through coding. However, I'm kinda stumped on how, exactly, to get values from a worksheet given certain criteria. For example, given a sheet with:code:
1. Given a particular value (ex. the ID number, or a unique value like Max # of cats), get the values under all columns for that particular person(s) and place them in select cells on another worksheet (say, variable "Target" defined as a range). So if I enter 1 into an input box for ID values, I want all of Jane's info to appear on another sheet in separate cells. I know I could just use vlookup, but I'm trying to work entirely through VBA. I also want to be able to pull out multiple people based on other critera, like "Staff" or "Cats" or whatever. 2. Given a variable "ChosenFloor", I want to randomly pick someone from that particular floor and display their info on another sheet. So if I enter 1, someone from floor 1 is randomly chosen and placed on the "CleanupDuty" sheet. The only way I can think of to do this is through using Range.Find command, then making that cell Active and using Offset to gather information from the relevant cells in the row, but first, that doesn't seem right, and second, I've seen elsewhere that using Active and Offset are bad habits. The second goal is might be beyond a beginner like me, but I feel the first should be achievable and useful, but I can't figure out the best way to do that. EDIT: Okay, I see that I can use Application.WorksheetFunction.VLookup when working with a unique ID, and that can also give me all of the other values. But how would I use it if I'm working with values that might be shared? HisMajestyBOB fucked around with this message at 03:47 on Jul 10, 2015 |
# ? Jul 10, 2015 03:21 |
|
HisMajestyBOB posted:I'm brand new to Excel VBA programming and I'm teaching myself through setting goals and trying to accomplish them through coding. However, I'm kinda stumped on how, exactly, to get values from a worksheet given certain criteria. For example, given a sheet with: I do this sort of thing with the autofilter. Once the filter is applied, you can do something like, .autofilter.range.copy wksOutput.Range("A1"). I can post the exact code for this later, if needed.
|
# ? Jul 10, 2015 22:05 |
|
That actually worked perfectly once I worked out the kinks. Thanks! I have it autofilter based on the input, then paste that autofiltered table into a clean sheet. This puts all the rows that match the criteria in an exactly predictable location, allowing me to pick out the unique ID numbers using Offset and store them in a dynamic array. Then it just has to randomly pick one of the stored ID numbers, use vLookup to get the data, and then display it. It works perfectly well with the existing table, and I think it should work well with an expanded table as well. code:
|
# ? Jul 18, 2015 03:42 |
|
imagine four worksheets on the edge of a cliff.. I need to print them to pdf, as quickly and hassle free for the user as possible. So far, I've got; code:
ThisWorkbook.Sheets(Array("1","2","3","4").Select.Range("A1:T60") ? E: I'm an idiot who missed Active.Sheet.Export and didn't think to try range there. Total Meatlove fucked around with this message at 13:13 on Jul 20, 2015 |
# ? Jul 20, 2015 11:03 |
|
Pivot chart question: I have a sheet that represents a PC replacement schedule. I'm trying to generate a pivot chart that shows the Replacement Year (x) as a consecutive set of labels on the x axis, but no matter where I place the field, it groups the years rather than lists them consecutively. For simplicity's sake, let's say this is the source data: The resulting pivot chart has the years grouped (yeah, I know the values don't add up, but the layout is what's important): How do I get the years to show as 2015 2016 2017 2018 2019 .... 2030? The other criteria is to have the bars represent the count of machines replaced in a given year, with the line representing the sum of the replacement cost of all machines in a given year.
|
# ? Jul 23, 2015 14:58 |
|
I was able to get the results I needed by summarizing the data in an intermediate range of cells, then creating the pivot chart based off of the summarization. Bonus: with this method I was easily able to stack the types into a single column, rather than having 5 columns per year (1 per type).
|
# ? Jul 23, 2015 19:05 |
|
I'm having a weird error I was hoping someone could help me with. I'm dealing with a legacy excel file for tracking pricing information, essentially it searches other tables for prices based on certain criteria, and the person who had it before me loved search strings so she essentially made a search string for each criteria then created that search string in the larger files. The goal of this formula is to go through the Maryland tab (MD), find all the values that are associated with that search string item, and then return the maximum value (basically just looking for the highest price in a certain part of MD).code:
When I drag this down from the state above and do a find and replace to reference to the Maryland tab instead of the other tab it works fine, and correctly returns the highest value. If, however, I then go into the formula and simply hit enter it returns zero. What am I doing by hitting enter that is causing the formula to no longer work? I'm going to create a new system without any search strings but I still would love to know what's causing this. Thanks all!
|
# ? Jul 24, 2015 19:14 |
|
The call to IF returns an array, which you then take the MAX of. This makes it an array formula, which must be entered with ctrl+shift+enter, not just enter. Once you've done this, the formula in the cell should appear surrounded by curly braces (like {=MAX(IF...)}).
|
# ? Jul 24, 2015 20:28 |
|
ShimaTetsuo posted:The call to IF returns an array, which you then take the MAX of. This makes it an array formula, which must be entered with ctrl+shift+enter, not just enter. Once you've done this, the formula in the cell should appear surrounded by curly braces (like {=MAX(IF...)}). Awesome, thanks a ton! Hadn't had much experience with array formulas.
|
# ? Jul 24, 2015 20:51 |
|
I'm trying to build a configurator that will create a bill of materials for everything included in a duct system. It needs to prompt the user for the length, diameter, material type, and thickness of a piece of duct, and then be saved to a list that can be edited if the user wants to change something or deleted outright. I've got the user prompt system down, but what I'm trying to figure out now is how to create different duct pieces as "objects" (not sure that's right term) that can be made to have different length, diameter, material type, and thickness properties. Here's the way I see it working: A user wants to create a new instance of a round duct. On the prompt screen, he enters the length, diameter, material type, and thickness, and then hits a Save/Add to List button. The round duct now appears on a part list, and the user can now edit or delete the item. When all the desired pieces are created, the user can create a bill of materials that list each part and all their characteristics. Any suggestions on how I should go about doing this?
|
# ? Jul 26, 2015 16:48 |
|
I have two spreadsheets of client account information from 2 different databases that need to be reconciled. My level of VBA skills is basic, so I'm a bit lost at where to start. My biggest issue is that there are errors in all of the information, including unfortunately the unique identifier, which was the main thing we relied on to identify a client in database A with his account in database B. So I can’t just try to match by a unique identifier, or match row by row, since potentially a client can be anywhere in the spreadsheet if their unique identifier has been mis-entered. I need something that will: 1. Identify rows where with exact matches in the relevant data (Client Name, Date of birth, email address, Identifier #) and list them or pull them to another sheet 2. Identify rows where the data has a partial match on some of the variables and list them and list them or pull them to another sheet 3. Identify rows in the first data set that don't have any matching variables in the second dataset at all. I know enough to figure out how to do the first one of the three. Any help pointing me in the right direction would be appreciated.
|
# ? Aug 7, 2015 23:50 |
|
I've tried using vlookup's approximate match for textual data and it is just god awful. Is there anyway to implement something better in VBA? I've had some great luck with Google Refine's clustering algorithms, but most of the time I'm stuck working in excel.
|
# ? Aug 8, 2015 01:06 |
|
Xandu posted:I've tried using vlookup's approximate match for textual data and it is just god awful. Is there anyway to implement something better in VBA? I've had some great luck with Google Refine's clustering algorithms, but most of the time I'm stuck working in excel. I've never used it, but http://www.microsoft.com/en-ca/download/details.aspx?id=15011 ?
|
# ? Aug 8, 2015 01:36 |
|
So I'm doing some data entry copying text that in the middle of a sentence in one cell into another, cause I'm too lazy to get the =mid() function working properly. About halfway through my list, Excel auto filled in the rest. It was relatively predictable text (city, state type stuff) but I've never seen it do something like that before. How do I make it happen again. Edit: never mind, I guess it's called Flash Fill
|
# ? Aug 21, 2015 16:12 |
|
I've been tackling a side project at work with Perl. I have a working solution but its a pretty shoddy hack. I'm thinking of re-writing the entire thing in Excel and VBA as a learning exercise. Outside of the taskscheduler, do these pseudo steps look possible entirely within Excel/VBA? 1. TaskScheduler to launch Workbook 2. Macro executes when Workbook is launched that: - Copies pipe-delimited text file from network folder to local folder - Loads that delimited file into workbook - Parses delimited file, pulling out needed information and spreading it over 6 named worksheets - Send each worksheet to a different specified network printer - Bonus step: zip delimited file and move to different folder - Close workbook and exit Excel
|
# ? Aug 27, 2015 00:52 |
|
|
# ? May 11, 2024 05:51 |
|
Hughmoris posted:I've been tackling a side project at work with Perl. I have a working solution but its a pretty shoddy hack. I'm thinking of re-writing the entire thing in Excel and VBA as a learning exercise. Outside of the taskscheduler, do these pseudo steps look possible entirely within Excel/VBA? All of it's possible in VBA.
|
# ? Aug 27, 2015 04:38 |