Macros and VBA
6286 TopicsConverter, VBA to Office Script.
A converter VBA to Office Script is a challenging task, but with VBA and regular expressions, many common VBA constructs can be converted to Office Scripts. This converter is intended to create an approach in Office Script and then the user can extend it with his knowledge. Since VBA and Office Scripts have different syntax and APIs, this converter will convert simple elements such as loops, conditions, and cell operations. A more complex VBA to Office Scripts converter requires advanced logic to analyze and convert the different syntax and commands of the two languages. The attached file tries to convert the VBA code into Office Script in a simple way. A lot of things are not taken into account, but it can be a useful tool to get started. I hope it works for you too and if you discover any problems or errors, I would be happy to hear your feedback.22Views0likes2CommentsI need a little help
I've played around with the code and I still can not get it to execute the command. Here is the code in question. If [C2] = "Initial Legal Filing" And [C34] = "Two Defendants-Served at Different Addresses" Then Sheets("Sheriff's Svc-Addtl Address").Visible = True Else Sheets("Sheriff's Svc-Addtl Address").Visible = False End If Its probably something simple and I just don't see it. No matter what is selected in C34 the sheet is always visible. :/27Views0likes2CommentsVBA Code: ensuring users fill out specific cells
Hi all, I'm looking for some help with the following: My team has a excel spreadsheet with a table in it. This spreadsheet gets passed around different users as they each need to fill in a row with their data. The problem is, not all users are filling in the "mandatory" columns. So, when I open up the document after everyone has supposedly filled it in, I see blanks where I should see data. I have used CoPilot to help write a VBA code that basically stops the document from being closed or saved until a row in the table has been filled in: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Not IsTableComplete() Then MsgBox "You must complete at least one row in the table before saving.", vbCritical, "Incomplete Data" Cancel = True End If End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) If Not IsTableComplete() Then MsgBox "You must complete at least one row in the table before closing.", vbCritical, "Incomplete Data" Cancel = True End If End Sub Function IsTableComplete() As Boolean Dim ws As Worksheet Dim tbl As ListObject Dim row As ListRow Dim isComplete As Boolean ' Set the worksheet and table name (update "Sheet1" and "Table1" to match your spreadsheet) Set ws = ThisWorkbook.Worksheets("Sheet2") Set tbl = ws.ListObjects("Table14") isComplete = False ' Default to incomplete ' Check if any row is fully filled out For Each row In tbl.ListRows Dim allFilled As Boolean allFilled = True ' Assume the row is complete Dim cell As Range For Each cell In row.Range If isEmpty(cell.Value) Then allFilled = False Exit For End If Next cell If allFilled Then isComplete = True Exit For End If Next row IsTableComplete = isComplete End Function However, when I fill in the first row, save and close the document, upon re-opening it, the warning messages disappear and I can save and close the document. I need the code to reset itself each time a user opens the document. So that it checks when its been newly opened for the next blank row, if that has not been filled in then the user should not be able to save or close the document until it is. Any help on this would be much appreciated :) The 'practice' table looks like this:17Views0likes1CommentIndex / Match function Error
Attachment file "column I" is derived with Index/ match & vlookup functions. It seems that there is some mistake as the values what is supposed to be is not as required. The required value has been populated in "column J". Appreciate the solution and help me understand what is going wrong with the formula given. Thanks in advance!13Views0likes1CommentDax measure not considering the filter context and not aggregating
Hi, I have the below visual and highlighted Dax is having problem: Below is Dax: noofdays = COUNTROWS(Calendar_) For the below selected filters, noofdays dax should display 60 for month of September 2024 and 62 for month of October 2024. The total aggregate value should be 122 days. But this dax is giving wrong values now. FYI, when I bring in DBName-Points_Id into the visual,it is giving correct values row by row but when removed it doesn't: FYR, My expected output should be like below: PFA file here Portfolio Performance - v2.15 (1).pbix Please let me know if you need further info! Thanks in advance! SergeiBaklan47Views0likes4CommentsExcel for Mac - Run-time error '1004': Method 'Name' of object 'Addin' failed
Dears, Whenever I open any Excel File (existing or blank), I get the following error message: "Visual Basic for Applications Run-time error '1004': Method 'Name' of object 'Addin' failed" Note: I don't have any VBA code in the file - again, this message also appears when opening a blank/new/empty file. I thought it could be related to one of the Add-ins that I had installed, but even after removing all of them, the message still appears. Does anybody know what it means and how to fix it? I'm running Excel for MacVersion 16.91 (24111020) from Microsoft 365 in macOS SequoiaVersion 15.1.1. Thanks in advance, Andre57Views1like3CommentsExcel pulls data from Outlook
Hello, We currently have an excel sheet which we access input the previous days date, todays date and hit a button and it shows all the incoming mail into a teams outlook mailbox. This is an old excel sheet we have been using for many years and now i need to do it for newer teams and am unable to work out how this is possible. I've looked online and used co-pilot and unable to find the answers. Attached screenshots below, i thought just changing the hyperlink would work but i think it's more in depth that than. Any help appreciated Joshua5Views0likes0CommentsPython in Excel quota problem
I understand that there is a quota. It's normal because Microsoft's servers are not sufficient. However, there's a problem: I have an Excel file with a total of 22 tabs, each containing independent calculations. When I change the content of a single cell, all formulas in all Excel tabs start working. Why are they all running, and why am I not controlling this calculation or compilation process myself? I have Anaconda installed on my machine. If you allow me to run the Excel calculations with Python on my machine without limits, it would be an excellent solution. The same issue exists with GPT. We can't perform large calculations on your servers. GPT already says, "You can run this code." GPT and Python in Excel only support small calculations with a few formulas. Unfortunately, large-scale enterprise operations fail. Since no CPU or GPU solution is available right now, at least allow running Python within Excel on our own machines until this crisis is resolved. If this isn't possible, only calculate the formulas in the tab I'm currently working on. Additionally, let me control this calculation process. When writing a code, all lines of code are executed for each row. This is very unnecessary.43Views0likes4CommentsRename Cell Contents
Have given this macro a shot, but it isn't working: Sub StandardizePayee() For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row If Cells(i, "B").Value = "Marathon" Then Cells(i, "B").Value = "Marathon Gas" End If Next i End Sub Would like to standardize payees for search purposes.3Views0likes0Comments