Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Microsoft Excel is a commercial spreadsheet application written and distributed by Microsoft.
10
votes
Accepted
Get table header name in excel
table formula - given a Table1 table name for the above table:
=INDEX(Table1[Category],MATCH([@Id],Table1[Id],0))
Excel likes data that's organized in rows and columns; if you have 2 levels of headings …
4
votes
Add up & sort a spreadsheet column
There are many iterative structures in VBA, but I think the one that would be most useful here is For...Next...Step; in your case, looks like Step should be 4, looping from 7 to 87.
All of your code …
18
votes
Accepted
Avoiding repeated code in worksheet
Doing Copy+Paste in your IDE should raise a big red flag and then there should be a neural inhibitor that prevents your left hand from doing it, causing your right hand to move your mouse further down …
7
votes
Accepted
Suspiciously redundant Excel macro code
Not relevant to your algo, but you shouldn't be using "" like this; use the vbNullString language constant instead, which consumes 0 memory (as opposed to "" which has the overhead of a string).
As f …
13
votes
Accepted
Importing data from an external EXCEL-Sheet
So, moving on:
Bring up a FileDialog, open any Excel file that the user selects.
Activate the 3rd sheet in the 2nd workbook (the one we just opened?) and keep a reference to the active sheet. …
5
votes
Looping through an Excel document in C#
Then I'd try to reduce the number of Excel worksheet reads, if that's at all possible. …
4
votes
Read table row with multiple options
The problem is that you're catching an exception that should be avoidable: reading an empty cell isn't something that should be exceptional in Excel after all. … Don't rely on exceptions when you can avoid them, especially with Excel interop. …
7
votes
Assigning value to cells with Excel VBA
I think that's [mis|ab]using VBA: Excel itself is very good at dealing with assigning cell values based on other cells' values. …
11
votes
Accepted
Using VBA to "apply names" to named range references
'No error handling should be needed
Except, you never really know what assumptions you're making without realizing. Better safe than sorry.
For example, here's where your procedure might blow up:
…
5
votes
Aggregating data from multiple worksheets into a consistent format
I'm aware that making all the declarations line up like this isn't an efficient use of time, but since it's already been done, I'm not about to go and spend more time deliberately undoing it.
Tha …
4
votes
Accepted
Function to return a string legal for a range name
Nice code, I like what you've been smoking. An alternative (better?) name for the function could have been Legalize, too.
You could easily modify it to optionaly verify existing names (e.g. Optional …
3
votes
Find Duplicate with 2 criteria
"CodeName" is a property of all sheet objects in Excel VBA; there's a global object reference pointing to these, readily available for you to use - no need to fetch it from WB.Sheets collection, which … Otherwise Excel will look "frozen" when it's actually completely responsive, just not redrawing itself... because you told it not to.
Don't assume things won't blow up. They always do. …
10
votes
Conditionally deleting rows in a worksheet
hide the status bar at any time - this feels rather surprising, especially since you could instead be using it to convey some "Please wait..." message to the user so they know your code is running and Excel …
8
votes
Extracting Country Names from Cell Values
country
i = i + 1
You need the values from 3 cells - store them in local variables, and reuse variables instead of accessing the worksheet over and over: accessing a worksheet is the slowest thing Excel-VBA …
3
votes
Accepted
Parsing cells containing Line Feed Characters
This "guard clause" does not need to be a block:
If workingRange Is Nothing Then
Exit Sub
End If
Inlining the Exit Sub makes it clearer that it's intended to be a "quick sanity check" and not …