|
Long Wang posted:Is there any way to do this? Have a template, that when opened, automatically displays the Open File dialog then execute the code from there. Have the user double click the template rather than the text file. Are the files sequentially named or somehow named in a way that you could automatically grab the most recent file and open it? That'd minimize input further.
|
# ¿ Aug 29, 2010 21:54 |
|
|
# ¿ Apr 28, 2024 07:44 |
|
Not the most efficient way, but it will do what you've asked:code:
|
# ¿ Oct 9, 2010 22:15 |
|
serewit posted:It was failing, but I see what the problem is. This should work okay, thanks! I've made the assumption that your department sheets are named exactly the same as the department code. Also, I have made the assumption that there is a sheet for every department on your master list sheet. I bet its saying subscript out of range because a sheet name doesn't match / the intended sheet doesn't exist. Can you provide an example of department code and sheet name, and say which line is causing the exception (highlighted yellow ehen you click debug).
|
# ¿ Oct 9, 2010 23:26 |
|
serewit posted:stuff It needs to be run from the main sheet. Here's some ammended code: code:
|
# ¿ Oct 10, 2010 00:02 |
|
edit: ^^^ No thanks, just glad I could help someone for a change. I'm always asking. Not really a coding question, but I have a template that does multiple functions (Add client, edit client, etc.) and I want the users to be able to select these functions from the ribbon. Calling the template from the ribbon opens the template and not a regular copy of it. How can I make the ribbon force template functions to open as non-template functions? Or should I just disable saving (they shouldn't require the need to save anything anyway). This is an example line from the ribbon customizations: code:
gwar3k1 fucked around with this message at 21:23 on Oct 12, 2010 |
# ¿ Oct 12, 2010 21:20 |
|
IceHawk posted:For example: Does simple concatenation work: "ChrW(&Hxxx) & ChrW(&Hxxx)" code:
code:
gwar3k1 fucked around with this message at 19:57 on Nov 3, 2010 |
# ¿ Nov 3, 2010 19:52 |
|
IceHawk posted:Except I don't quite understand what your second macro does (I'm a Linguist and all I have is one year of computer science under my belt), all of my data is formatted so that column C contains the empty fields that I need to put the translation into, and column E contains the source. Sorry, the macro assumes you have a sheet named "TransLookup". On that sheet you have a column (A) which contains your original characters, and a second column (B) which contains the characters that col A should be changed to. I'm assuming your task is as simple as "change xx to yy" without any conditions (i.e. not accounting for "change xx to yy but if xx preceeds xxz then change it to ccc"). The macro loops all the worksheets in your book that aren't TransLookup (which it is using as reference) then it is making the replacement for every replacement you have instructed it to do (all rows on TransLookup). Does that make sense?
|
# ¿ Nov 3, 2010 20:49 |
|
Here's a sub that'll do what you want (identify duplicate positive dates):code:
|
# ¿ Nov 4, 2010 18:46 |
|
IT Guy posted:Actually, I made a mistake, I need to check array2 to see if every value is the same or unique. No, the sub I posted will store a list of unique values and return true if there are any duplicates. You can validate by doing: code:
code:
|
# ¿ Nov 4, 2010 19:14 |
|
I would have posted a modified version of my sub, but Zhentar's is much better.
|
# ¿ Nov 5, 2010 19:00 |
|
Meme Emulator posted:So long as people can interpret a boolean value as working/not working, you surely don't have an issue, other than using the wrong chart type. Use a bar graph, y-axis is your condition, x-axis is the day and you plot every machine on every day. In the image, 1 is working, 2 is not. You could also make it obvious which machine wasn't working on which day by using 0 for working (will not display on the chart) and 1 for not working. gwar3k1 fucked around with this message at 18:45 on Jan 7, 2011 |
# ¿ Jan 7, 2011 18:40 |
|
Or not even a loop: iRow = Range("U1:U60000").End(xlDown).Row + 1 'Will find the first blank cell from U1 counting up 1,2,3... 'Replace xlDown with xlUp to find the last cell with data then add 1 to suggest the first blank cell at the end of the column '60000 because I don't remember the 97-03 max row number, 65366? gwar3k1 fucked around with this message at 19:39 on May 24, 2011 |
# ¿ May 24, 2011 19:37 |
|
This is untested but this should copy all your sheets onto one sheet TempData, sort it, then create new sheets for each location and copy the data from TempData to Location one row at a time.code:
|
# ¿ May 26, 2011 02:00 |
|
Sounds like a few nested ifs really but I thought I'd write some VB for you. You could probably work out an excel function from this. Untested and I think the loop might be insufficient. code:
code:
|
# ¿ Jun 13, 2011 09:06 |
|
As you've got the best solution, this is just to answer questions if you're curious.spregalia posted:When I go to debug, I get the error at: As Sub Par said, the loop should have been literal 176400 but I was in a rush and admittedly didn't think it would have been a limitation in VBA. spregalia posted:Should this be RC=$A2? The Excel function I wrote was pseudo code where you should replace RC with the actual cell reference from your data sheet. code:
The formula would go in all the cells of your matrix starting at B2 based on your image. spregalia posted:I'm not sure if I follow, are you saying the VB code is identical to this if function (in other words, the VB is unnecessary)? For a transposition excersize like this, I always pick VBA because I fear pivot tables (lack of understanding), which I why I wrote the macro. I provided the Excel function because I figured it would be a simpler way of doing what you wanted, albeit excessive and I don't even know if it was fit for purpose - I wrote it while I was eating my breakfast. They should have been use exclusively, so you were right.
|
# ¿ Jun 13, 2011 20:38 |
|
ActiveSheet.Paste should be sufficient with you selecting Sheet11.Cells(3,1) before hand. I've never had to use Destination:=... before. Its possibly that. Should you expect Excel to split vbTab and vbNewLines into columns and rows? You're making a formatted string which I assume would just paste into a single cell as the string you defined (but I've not used clipboard either). Consider your first method, but put Application.ScreenUpdating = false at the start of your routine and true at the end. Screen updating is often the slowest part of a massive loop, I've found.
|
# ¿ Aug 2, 2011 08:55 |
|
Baxta posted:Activesheet.paste just puts it all into A3 however vbnewline enables it to actually go down the right number of rows just all the row data ends up in the one column ( it won't paste as recognizing the vbtab should be forcing it to spam the rows like in my output for the for loop. How about this: Paste it to a text file, save. Open as tab delimited, copy Paste in required workbook, close & delete text file
|
# ¿ Aug 2, 2011 18:13 |
|
Microsoft is inclined to agree. Try vbCr instead of vbNewline. Maybe even trim the last vbTab before each newline?
|
# ¿ Aug 2, 2011 22:28 |
|
Baxta posted:EDIT: Just in case anyone was wondering, ActiveX controls dont work with Office for Mac 2011. Have you moved from 2003 (or the Mac equivalent) to 2011? Do you know that .xlsx files don't allow macros where as .xlsm do? Sorry if you already know this, but its the first thing that I'd check. Same goes for templates: .xltm allows macro use and isn't the default.
|
# ¿ Aug 9, 2011 21:30 |
|
Start by rationalising (normalising?) your data. Know what fields/layout you need on your master spreadsheet and design the interface that will feed into that. Then if necessary, create the tools required to migrate from the multiple documents into the single document. When you're done making your life easier, move the originals out of their current locations so your users cannot use them. Force them to use the single workbook or they never will. I've recently moved into a job where we use Spiceworks which covers all the stuff your boss couldn't keep track of, as well as toner use and a whole treasure chest of amazing stuff. We primarily use it for the helpdesk system though. Perhaps you could look into that as a useful piece of software.
|
# ¿ Aug 11, 2011 18:33 |
|
I Love Topanga posted:I would like to have Excel take a look at Column A, run a google search, and spit the first result into Column B. First, do a google search and figure out where your query goes in the URL. Then record a macro that: Uses Web Data (Data > Get External Data > From Web) [Paste your query url in the address bar] Select the page (click the yellow box with an arrow in it) Saves the web query to a new sheet Copy the cell with the link you want (first result) Paste it into your sheet B1 Delete the web query sheet When you stop recording, you can see the VBA that Excel produced by going into the IDE (Alt+F11). If you're comfortable with code, mess about with it.
|
# ¿ Aug 19, 2011 19:40 |
|
uG posted:I need to create some rather large excel files (100k+ rows, 200ish columns, 10 worksheets). I tried using Perl, but it doesn't free memory and eventually runs out. Do any scripting languages (the more *nix friendly the better) have the ability to create such large excel files? Of random data? Can you just use VBA to do this? I assume you're using 2007+ as 2003 and below cap at 65536 rows or there abouts. Is the excersize to have it create an xls within Excel, or could you create 10x csv files and import those as sheets into an Excel workbook?
|
# ¿ Aug 30, 2011 21:28 |
|
Use a group panel to show/hide multiple elements with minimal code. Have two groups, one over lapping the other and your radio buttons outside of them both (underneath?). You can add code to the radio change event in the VBE (double click the radio button on the designer, then top right of the code window is a drop down menu with the different events for the element in the menu to the left). If true then group1.visible = true else .visible = false and the opposite for the other radio button. You could use the scroll button tool for a 0 - 1 scale.
|
# ¿ Sep 20, 2011 23:16 |
|
Setup some pivot tables, or a single pivot table and make yourself a dashboard. I've recently got into them and they've made my life so much easier.
|
# ¿ Oct 9, 2011 18:56 |
|
Set up an interface using vba and forms which allows users to edit rows and commit them to the database rather than allowing them to change them directly on the sheet. An alternative, or parallel solution, depending on just how large your data set is copy the data sheet to a hidden sheet then when the user changes a cell on their visible sheet, you have a flag on the hidden sheet to say changed. Update that row safe in the knowledge any uniquely identifiing data hasn't been modified. Rather than using a second sheet, you could prevent changes by modifying the cell handling. On cell entry, create a string variable with the original content. On cell change, check to see if it's changed - if so and it shouldn't, use the variable to set it back or if it should be changed, set your flag to alert your code to update that record. I'd say the interface method is the way to go though. How much data do they need to see in the first place? Can they query what they need rather than have it all on show?
|
# ¿ Oct 18, 2011 18:25 |
|
Do you know visual basic at all? You could experiment with the following code (making it more flexible for number of lines per group, reading column names and using the column number as a variable rather than fixed numbers in code... Assuming your list of addresses is on a sheet called data and there is a sheet called formatted; and that on data, the column order is firstname, lastname, add 1, city, state, zip, tel 1, tel 2, tel 3, email code:
|
# ¿ Dec 5, 2011 00:07 |
|
Have you tried changing the security level to low? You should be able to run a query without having to change that, but perhaps its a function of 2003 -> 2007 security zealotry? Developer Tab > Macro security. If you have any work involving the analysis tool-pak, I know that is different between versions of Excel, maybe that's halting execution. If you look in the VB editor in 2007, missing references (for the workbook, not the VB references) will be highlighted in blue in the project window (Ctrl+R). e: does the remote PC map to the database in the same way that the server pc does? We have a mapped drive L:\ to allow users access to the database stuff, maybe the connection string is to C: rather than the share? gwar3k1 fucked around with this message at 00:13 on Jan 17, 2012 |
# ¿ Jan 17, 2012 00:09 |
|
Put the checkbox values in to an array then loop the array for evaluation if it makes you feel better. You don't really need to optimise something this small. Alternatively, you could use a function which runs through a nested if but uses Exit Function to break out before it traverses the full statement?
|
# ¿ Jan 19, 2012 23:28 |
|
935 posted:I think this is an easy question. Say I have a workbook and on sheet1 I have a list of students. You would start by adding a column on sheet 1 to define which desk that student sits at. My code assumes you just put the desk number in column F (i.e. not Desk 1, just: 1) Press Alt+F11 to open the Visual Basic editor. On the left under VBAProject, double click on "Sheet2 (Sheet2)" to open a white page. Paste this code: code:
|
# ¿ Feb 11, 2012 18:11 |
|
az jan jananam posted:I have a list of birthdays that are in columns like this Check the help for Text and Date functions. You'd use Date to turn H,I and J into a valid date format, then Text to format it how you want.
|
# ¿ Feb 17, 2012 22:30 |
|
|
# ¿ Apr 28, 2024 07:44 |
|
Do you need to add the VLookup using code as well? Excel has a macro recorder which you might be interested in to learn how macros are constructed for the tasks you want. For example, you could record a macro where you rename a sheet and enter a value in to cell A1 of that sheet. You use the code generated and put it into a loop and add any extra code you need to perform. Assuming you use a list thats comma delimited ("Steve, Graham, Ken,...") then this will do what you need, or is at least a starting point if you need to add any more code in. Untested. code:
|
# ¿ Mar 13, 2012 19:55 |