Excel dropdown with name/value pairs

Simple! Here is what we are going to get! 3 Steps Only: Define a range to use as the lookup value Create the dropdown list Paste in some code Step 1: Setup Sheet2 like this and define a Named Range as _descrLookup: ( Highlight -> Right-Click -> “Define Name…” ) This is an optional step, … Read more

Recommended IDE for VBA [closed]

I use and recommend Rubberduck. Description from the website: Rubberduck is a very active open-source COM add-in project that integrates with the Visual Basic Editor to enable the features every programmer wants to have in their IDE. From unit testing to source control, from code inspections to refactorings, programming in VBA will never be the … Read more

excel vba call subroutine with variables

You would call the sub as EnterCellValueMonthNumber “N23:Q23”, 1 No brackets. Or Call EnterCellValueMonthNumber(“N23:Q23”, 1) Brackets, and Call before it. Also, your Sub is expecting a Range object as the first argument and you’re supplying a string; you should change the signature of the sub to: Sub EnterCellValueMonthNumber(cells As String, number As Integer) Also, I’m … Read more

Counting duplicates in Excel

I don’t know if it’s entirely possible to do your ideal pattern. But I found a way to do your first way: CountIF +——-+——————-+ | A | B | +——-+——————-+ | GL15 | =COUNTIF(A:A, A1) | +——-+——————-+ | GL15 | =COUNTIF(A:A, A2) | +——-+——————-+ | GL15 | =COUNTIF(A:A, A3) | +——-+——————-+ | GL16 | =COUNTIF(A:A, … Read more

How do I sort a table in Excel if it has cell references in it?

I’m pretty sure this can be solved with the indirect() function. Here’s a simplified spreadsheet: A B C D … +——————————————————+- – – – – – – – – 1 |CITY |Q1-Q3 SALES|ANNUALIZED SALES:(Q1+Q2+Q3)*1.33| +======================================================+- – – – – – – – – 2 |Tampa | $23,453.00| $31,192.49| +——————————————————+ 3 |Chicago | $33,251.00| $44,223.83| +——————————————————+ … Read more

In Excel VBA, how do I save / restore a user-defined filter?

Have a look at Capture Autofilter state To prevent link rot, here is the code (credit to original author): Works with Excel 2010, just delete the commented line marked. Sub ReDoAutoFilter() Dim w As Worksheet Dim filterArray() Dim currentFiltRange As String Dim col As Integer Set w = ActiveSheet ‘ Capture AutoFilter settings With w.AutoFilter … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)