excel-2016

How can I produce a regular Excel formula as the result of a query?

非 Y 不嫁゛ 提交于 2020-01-24 22:08:13
问题 I have a large and complicated Excel query, which works as desired. However, I'm implementing some real-time data-validation features (i.e. not requiring a data refresh), and I need to have a regular excel formula in one of the columns of my query results. This formula would perform a real-time data comparison using other sheets in the workbook, intentionally independent from the query itself. Can I add a custom column with no value? I assume the values null or "" would overwrite any pre

Fix date when print sheet in excel 2016

情到浓时终转凉″ 提交于 2020-01-24 22:06:08
问题 I have a sheet with a cell that must to show the printed day. For example, the cell W1, in the sheet 01 will be printed today at night and at moment that print it, that cell must to show the current day. It has to be automatically when the sheet is printed. If tomorrow I open the workbook, in that sheet it has to view the day of printed and not NOW() It could be possible? Thanks. 回答1: Open Macro and on the ThisWorkbook: Private Sub Workbook_BeforePrint(Cancel As Boolean) For Each wk In

Device ID with Excel VBA

三世轮回 提交于 2020-01-23 17:35:07
问题 I would like to extract the IMEI number/Device ID from the computer using excel. In CMD I can do it in this way: :netsh mbn sh interface" and from the list given I take the Device ID. I was tryong to find something online but no luck so far, that's why I'm asking your help, maybe some of you knows where to search or how to start. How can I do this with excel vba? 回答1: You can use the following and then use split function to extract what you need Option Explicit Public Sub TEST() Debug.Print

Create calculated tables in Excel 2016 Data Model

☆樱花仙子☆ 提交于 2020-01-15 08:52:46
问题 I have multiple tables in Excel 2016 data model. These tables come from data maintained in other excel worksheets and are imported through Excel Query to populate a data model to take advantage of superior data management features that are available (e.g., DAX, date tables, relational joins, etc.) However, I would like to be able to create "calculated tables" (with DAX expressions) by applying filters, unions, etc. to target and transform the existing data elements. The goal to use the

VBA - Method to Detect Compilation Failure

守給你的承諾、 提交于 2020-01-06 08:14:27
问题 I have the following code: Public Function Compiler() On Error GoTo ErrorHandler Compiler = "Successfully Compiled" Dim compileMe As Object Set compileMe = Application.VBE.CommandBars.FindControl(Type:=msoControlButton, ID:=578) If compileMe.Enabled Then compileMe.Execute End If Exit Function ErrorHandler: Compiler = "Unable to Compile - " & Err.Description End Function It is very similar to the suggestion posted here, and it doesn't work. It you introduce errors into the rest of your

Loop through named range list

旧街凉风 提交于 2020-01-06 06:24:10
问题 I found a lot of examples but it's not working in my case and I don't know why. Very basic code: Sub Test() Dim namCur As Name For Each namCur In ActiveSheet.Names MsgBox "Name: " & namCur.Name & ", Refers To: " & namCur.RefersTo Next namCur End Sub And I have the same issue when I use Worksheets("Assumptions").Names When I watch ActiveSheet.Name , this is correct I get "Assumptions", you can see on the picture below the list of named ranges. But I never get the MsgBox and the For loop goes

MS Excel Scatterplot converts Months to Numbers

﹥>﹥吖頭↗ 提交于 2020-01-06 05:09:09
问题 Software: MS Excel 2016 Link to files: GitHub Repository Sheet2 of month.xlsx has table When I select it and Insert Scatterplot, Chart1 of month.xlsx is the result. No matter what I try, I cannot get the X-Axis to display in Months (right now it displays Month's number). Help! 回答1: The problem is most likely the way you have your months stored. By the looks of things I would hazard to guess they are actually text and not numbers formatted to display the name of the month in full. In order to

How to call a function on ENTER key in Excel using vba

青春壹個敷衍的年華 提交于 2019-12-29 06:31:15
问题 Google should provide me with ample examples but none of them seem to work What I want: Everytime the user presses, and then releases, the ENTER key, for my program to do do something (ie. create a MsgBox, or call function Foo). I would prefer this in the form of a MWE What I have done: I have tried googling it but none of the examples are functional. They compile, but don't do anything. I have also made sure to save in a macro compatible Excel format. What I am using: I am using Excel 2016,

Office.js: Can I set the fill of a range of cells from a 2d array?

隐身守侯 提交于 2019-12-25 08:38:50
问题 So far, with office.js, I'm getting used to this pattern, where you assign an array of data to a corresponding excel range: range.values = [["Eurasia", "29.96", "0.25", "15-Feb" ]]; range.numberFormat = [[null, null, null, "m/d/yyyy;@"]]; However, I'm trying to change the background color of a range of cells using different colors in different cells and I already have a 2d array of colors which pertain to each cell. As far as I can tell, it looks like you can assign the fill color by looping

Workbooks.OpenText not parsing csv files properly Excel 2016

隐身守侯 提交于 2019-12-25 06:09:04
问题 I'm pretty sure this worked properly in previous versions of Excel Test File: d/mm/yyyy hh:mm:ss 5/12/1999 6:01:12 30/11/2001 5:00:00 And the delimiter between the date and the time is a Space (ASCII code 32) If the file is saved as a .txt file, the OpenText method parses properly. If the file is saved as a .csv file, the OpenText method doesn't seem to work at all If the spaces are replaced with commas, and the file is saved as a .csv file, the OpenText method will split the lines into two