excel-vba

Pulling data from SAP using Excel Macros

六月ゝ 毕业季﹏ 提交于 2020-01-01 19:08:11
问题 So I am trying to pull data from SAP using excel macros. I am new to VBA so please bear with me. I found a topic on here called VBA pulling data from SAP for dummies and I am confused. What I am trying to do is as follows: Copy a notification number from a list in excel. Go to the appropriate screen in SAP and paste this number in the search box. Open the long text box. Copy the long text. Paste into excel. Here is the link VBA pulling data from SAP for dummies I can't seem to get by Set

VBA doesn't return the correct Date with Now()

回眸只為那壹抹淺笑 提交于 2020-01-01 19:00:10
问题 I have a simple code and VBA cannot return the correct date: Sub Test_Date () Debug.Print Format(Month(Now()), "mmm") Debug.Print Month(Now()) Debug.Print Now() End Sub Returns: Dez 1 29.01.2018 11:17:55 1) Is that an Excel well known issue or did I make a mistake? 回答1: It is a known issue. And it is actually not an issue. In Debug.Print Format(Month(Now()), "mmm") you are passing Debug.Print Format(1,"mmm") . And the first day in VBA is 31.12.1899 . And its month is December . Run this small

On workbook open, Excel Macro to refresh all data connections sheets and pivot tables and then export the pivot to csv

时光总嘲笑我的痴心妄想 提交于 2020-01-01 18:59:29
问题 I have an Excel File which has CSV Data sources and Pivot tables, I want to refresh all the data sources and pivot tables automatically and export one pivot table as CSV on opening the excel file. I tried the below code, but this code export the CSV file before the data getting refreshed. please help with a solution. Thanks in advance. Private Sub Workbook_Open() ThisWorkbook.RefreshAll Run "Macro1" End Sub Sub Macro1() Dim ws As Worksheet, newWb As Workbook Dim SaveToDirectory As String

MS Office 2013 - VBA password security [duplicate]

心已入冬 提交于 2020-01-01 18:19:16
问题 This question already has answers here : Is there a way to crack the password on an Excel VBA Project? (22 answers) Closed 4 years ago . I am wondering about how safe is the VBA password on MS Office 2013. I've searched online and there are a bunch of websites selling software to do it, is it reliable? I want to develop some security around my office files that would depend on the VBA code inside, but if the vba code inside can be easily changed/seen it's non sense going that way. Thanks 回答1:

Self-referencing from inside an Excel VBA control

帅比萌擦擦* 提交于 2020-01-01 17:45:52
问题 I'm trying to get a property value of a button control from inside the button's click event without using the button's name (since I want to use the same code for each of many buttons on the Excel sheet). After much research, I see many references to try the following: Me.ActiveControl.name or Me.Shapes(Application.Caller).Name However, both of those throw an error when executed from within Excel. Note that I'm using Excel 2010. Thanks for any help in advance. Lee 回答1: What you want is

Self-referencing from inside an Excel VBA control

浪尽此生 提交于 2020-01-01 17:44:38
问题 I'm trying to get a property value of a button control from inside the button's click event without using the button's name (since I want to use the same code for each of many buttons on the Excel sheet). After much research, I see many references to try the following: Me.ActiveControl.name or Me.Shapes(Application.Caller).Name However, both of those throw an error when executed from within Excel. Note that I'm using Excel 2010. Thanks for any help in advance. Lee 回答1: What you want is

Self-referencing from inside an Excel VBA control

眉间皱痕 提交于 2020-01-01 17:44:37
问题 I'm trying to get a property value of a button control from inside the button's click event without using the button's name (since I want to use the same code for each of many buttons on the Excel sheet). After much research, I see many references to try the following: Me.ActiveControl.name or Me.Shapes(Application.Caller).Name However, both of those throw an error when executed from within Excel. Note that I'm using Excel 2010. Thanks for any help in advance. Lee 回答1: What you want is

Format cells in excel for decimal places using a macro

无人久伴 提交于 2020-01-01 17:37:22
问题 How can I format Cell (D:) 2 decimals places Cell (E:) 1 decimal place and Cell (H:)3 decimals places in excel using a macro? 回答1: the numberformat property of a range will format it to any custom format sheets("sheet1").range("D:D").numberformat = "0.00" sheets("sheet1").range("E:E").numberformat = "0.0" sheets("sheet1").range("H:H").numberformat = "0.000" for numbers with a comma or currency displayed this would work: sheets("sheet1").range("D:D").numberformat = "&#,##0" 来源: https:/

Can you refer to an external macro with excel?

試著忘記壹切 提交于 2020-01-01 17:27:07
问题 I have a reasonably complex macro that I need to run on multiple different excel sheets, this macro is updated periodically and whenever a change is made its necessary to change it in each individual excel sheet. is there a way to get each excel document to refer to the one macro? for example if i had a hierarchy like this: DOCUMENTS: -xlsheet1.xls -xlsheet3.xls -xlsheet2.xls MACROS: -macro1.bas where there was a button in each sheet that ran macro1 when clicked. 回答1: I would recommend either

Get the non-matching part of the pattern through a RegEx

不羁岁月 提交于 2020-01-01 17:08:13
问题 In this topic, the idea is to take "strip" the numerics, divided by a x through a RegEx. -> How to extract ad sizes from a string with excel regex Thus from: uni3uios3_300x250_ASDF.html I want to achieve through RegEx: 300x250 I have managed to achieve the exact opposite and I am struggling some time to get what needs to be done. This is what I have until now: Public Function regExSampler(s As String) As String Dim regEx As Object Dim inputMatches As Object Dim regExString As String Set regEx