excel-vba

Checkboxes for multiple values in a single cell in Excel

≯℡__Kan透↙ 提交于 2020-01-01 03:20:12
问题 I am a C#/.NET developer but am not too familar with Excel programming or VBA. For a side project, I have a spreadsheet that will be used by non-technical users for data entry. Later this spreadsheet will be exported to a different format via a C# command-line program that I wrote so that the data can be dumped into a different system. I need the data values to be entered exactly as the command-line program will expect them to be, so user error due to typos or slight wording differences would

How to export an Excel sheet range to a picture, from within R

社会主义新天地 提交于 2020-01-01 02:39:16
问题 We are trying to automate the creation of some picture files within an R Script. We have the Excel files looking the way that we want them to, but now need to make a JPG or PNG picture-copy of those excel tables for easier web posting. We've been using the library(xlsx) package for most of our interactions between R and Excel, and it looks like we should be able to send specific java commands through something like ?.jmethods but it's unclear how we would pass as many lines as we need to. In

Delete worksheet in Excel using VBA

痴心易碎 提交于 2020-01-01 01:25:22
问题 I have a macros that generates a number of workbooks. I would like the macros, at the start of the run, to check if the file contains 2 spreadsheets, and delete them if they exist. The code I tried was: If Sheet.Name = "ID Sheet" Then Application.DisplayAlerts = False Sheet.Delete Application.DisplayAlerts = True End If If Sheet.Name = "Summary" Then Application.DisplayAlerts = False Sheet.Delete Application.DisplayAlerts = True End If This code is returning an error: run time error #424,

Is it possible in VBA convert Excel table to json

元气小坏坏 提交于 2020-01-01 00:48:09
问题 I need convert data from excel table with about twenty columns and a lot of rows into json. I don't found a short example of code for this purpose in vba. I found this one https://github.com/VBA-tools/VBA-JSON/blob/master/JsonConverter.bas , but it is very large. May be it is a shorter example? 回答1: I'd go with modified version of this one: http://www.excelvbamacros.in/2015/01/export-range-in-jason-format.html if you want to write it to file there's a code: Dim fso As Object Set fso =

Get Excel sheet name and use as variable in macro

浪子不回头ぞ 提交于 2019-12-31 19:57:09
问题 I'm trying to find a way to use an Excel sheetname as a variable in a macro that I've written. Every month I deal with a workbook that is sent to me with 2 sheets. Part of the macro uses the 'Open File' interface to navigate to the folder and open the file. The first sheet in the file is called 'Report', which is static. All I do with that is delete it (because I don't need it). The second sheet could be called anything and that's the sheet upon which I need to run the macro. Is there a way

Get Excel sheet name and use as variable in macro

旧巷老猫 提交于 2019-12-31 19:56:36
问题 I'm trying to find a way to use an Excel sheetname as a variable in a macro that I've written. Every month I deal with a workbook that is sent to me with 2 sheets. Part of the macro uses the 'Open File' interface to navigate to the folder and open the file. The first sheet in the file is called 'Report', which is static. All I do with that is delete it (because I don't need it). The second sheet could be called anything and that's the sheet upon which I need to run the macro. Is there a way

Recommended IDE for VBA [closed]

試著忘記壹切 提交于 2019-12-31 08:06:21
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Is there a recommended IDE for developing Excel VBA macros that provides reasonable error reporting and code completion? Currently, I'm using "Microsoft Visual Basic For Application" IDE which comes with Excel 2007, but so far, it is less than ideal. Even a plug-in to Vim or Emacs will be great. 回答1: I use and

A copy of Excel Addin is created in My Documents after saving

徘徊边缘 提交于 2019-12-31 07:41:39
问题 I have an application (running in IBM Notes, using Lotusscript etc.) that create a new Excel object via OLE automation. In my app I create a new Workbook and saving it to a temporary folder (I am saving it as Excel Worksheet w/o macros -> type 52) so that the resuting file is sth. like that: tmp_abc1234.xlsx Then I open the file in Excel programmatically. I have an Excel Addin (filename is "Teamoffice.xlam" loaded where some macros reside I will trigger in the custom save actionbar button. In

View and hide columns in excel using vba

廉价感情. 提交于 2019-12-31 07:33:11
问题 I have a worksheet with values in columns B:G. In the same sheet in cell A1 I have made a drop down list using data validation with values like A, B and C. What I require is when I select cell value A then columns B:C need to be visible and the other columns should be hidden from D:G. In the same way if I select B from the list I need to view columns D:E and B:C and F:G should be hidden. Could you please help me on this. Note: I don't have good knowledge in VBA. 回答1: Try this: Open the VBA

How to use OR Operator with SumIfs() [duplicate]

核能气质少年 提交于 2019-12-31 07:31:16
问题 This question already has answers here : VBA - SumIfs with Or (2 answers) Closed 2 years ago . How do I use SumIfs to sum if 1 out of 3 criteria (=OR) matches? How can I use OR for the criteria? Here is the pseudocode. Sub SumDemo() Dim Sum Sum = Application.WorksheetFunction.SumIfs([REVENUE], [UNIT], "=avengers", [region], "=north OR =south OR = west") MsgBox Sum End Sub 回答1: Try googling “VBA excel sumifs Or” and you will find result #1: VBA - SumIfs with Or Dim Sum as Double Dim Revenue As