[Solved] Excel VBA – Referencing a named range in a formula

You will need to fill in the address into the string. .Formula = “=COUNTIF(” & ReqItems.Address & “,””>0″”)” Please also note that Dim ReqItems, SupItems As Range only declares SupItems As Range but ReqItems will be of type Variant here. You will need to declare a type for every variable. Dim ReqItems As Range, SupItems … Read more

[Solved] Calculating new cells containing True/False outputs from cells also containing #N/A values using VBA

Handling the infamous VBA Errors (2042) successfully!? Before using this code be sure you have studied at least the customize section carefully or you might lose data. Most importantly the second column must always be adjacent to the right of the first column, otherwise this code couldn’t have been done with the ‘array copy-paste version’. … Read more

[Solved] What would be the appropriate syntax for clicking the “send to” drop down menu? (See image for reference)

Try an attribute = value CSS selector to target the element by an attribute and its value. IE.document.querySelector(“[sourcecontent=”send_to_menu”]”).click Make sure you have a sufficient page load wait before trying to click. As a minimum you need While IE.Busy Or IE.readyState < 4: DoEvents: Wend IE.document.querySelector(“[sourcecontent=”send_to_menu”]”).click You could also use IE.document.querySelector(“#sendto > a”).click 0 solved What … Read more

[Solved] I am confused on purpose of using “Not”, also on matching of “If” criteria, code says “is nothing” else run code for “MsgBox”

I am confused on purpose of using “Not”, also on matching of “If” criteria, code says “is nothing” else run code for “MsgBox” solved I am confused on purpose of using “Not”, also on matching of “If” criteria, code says “is nothing” else run code for “MsgBox”

[Solved] How to convert to percentage [closed]

Perhaps the following VBA solution using Regular Expressions. Function FixMyPercentages(target As String) As String Dim output As String output = target With New RegExp .Global = False .MultiLine = True .IgnoreCase = False .pattern = “\s\d+\.\d+$|^\d+\.\d+\s|\s\d+\.\d+\s” Dim myMatch As Object, myMatches As Object Do While .test(output) Set myMatches = .Execute(output) For Each myMatch In myMatches … Read more

[Solved] Macro to find header in excel

This is for your example i have grouped the 2 file data in single sheet. please see the below snap. I have created a small UDF to get your required output. Paste the below UDF in Module and you can directly call this from the cell itself. Public Function searchstring(a As Range, b As Range) … Read more

[Solved] Copying and Pasting between Workbooks VBA

As you have supplied no code, this should be sufficient enough to get you started. You’ll need to edit this and fix this to suite your needs. Sub test() Dim Wb1 As Workbook, Wb2 As WorkBook, Wb3 As Workbook Dim MainBook As Workbook ‘Open All workbooks first: Set Wb1 = Workbooks.Open(” path to copying book … Read more

[Solved] Calculating partial months salary costings for employees on a project in Excel [closed]

In cell I2, put the following formula (see UPDATE section for a simplified version): =LET(setPrj, A2:E12, setRoster, A15:F33, SOMs, I1:T1, namesPrj, INDEX(setPrj,,1), startsPrj, INDEX(setPrj,,4), endsPrj, INDEX(setPrj,,5),names, INDEX(setRoster,,1),starts, INDEX(setRoster,,2), ends, INDEX(setRoster,,3), salaries,INDEX(setRoster,,6), empty, “,,”, SPLIT, LAMBDA(x,case, LET(y, TEXTSPLIT(TEXTJOIN(“;”,,x),”,”,”;”), z, FILTER(y, INDEX(y,,1)<>””, NA()), IFS(case=0, z,case=1, HSTACK(INDEX(z,,1), 1*CHOOSECOLS(z,2,3)), case=2, 1*z))), BYCOL(SOMs, LAMBDA(SOM, LET(EOM, EOMONTH(SOM,0),endsAdj, IF(ends > 0, ends, … Read more

[Solved] How to find the days difference between two dates [closed]

Instead of using vba just enter the formula for the first row on C1 : =ROUND(a1,0)-ROUND(b1,0) Then just the formula to the end of exisiting rows. If you insist using vba code use the simple code below: Dim LastRow As Long LastRow = ActiveSheet.Range(“A” & Rows.Count).End(xlUp).Row Range(“c1”).Select ActiveCell.FormulaR1C1 = “=ROUND(RC[-1],0)-ROUND(RC[-2],0)” Range(“c1”).AutoFill Destination:=Range(“C1:C” & LastRow) End … Read more