vba

Excel Macro R1C1 formula not retaining values

无人久伴 提交于 2021-02-17 06:54:51
问题 I have an excel macro that creates a new excel sheet and fills it with a variable number of rows. I have a count of the number of rows stored in a variable. I'm using an R1C1 formula to multiply two cells together based on my row count. In the macro the formula looks like it's correct (if I add a break point and put a watch on it) but when the macro finishes the formula in the cell is incorrect. VB Code to generate formula: MainSheet.Cells(RowCount + 6, 6).FormulaR1C1 = "=R[" & RowCount + 3 &

How to VBA wait for windows save dialogbox and sendkeys

▼魔方 西西 提交于 2021-02-17 06:50:09
问题 I'm creating a macro file that download and save extracted data from SAP old version 7.20 , when the save dialogbox is appear , the windows dialogbox is not detected since my client SAP version is old 7.20. now my resolution on this is the sendkeys but the problem is some of the data is containing large amount that getting unreliable time to send the keys. How to wait for the save dialogbox and when appear sendkeys. Sub test() waitTime (10000) Call SendKeys("{Enter}", True) End Sub Function

VBA cut-paste range of data

Deadly 提交于 2021-02-17 06:35:31
问题 I'm attempting to make a large amount of Genetic data, a little more legible in Excel using VBA. I am trying to cut and paste every 7 cells that have data, after the 15th column, and drop them down under columns 8-15. The example of what I need is in the picture included. DATA EXAMPLE (RAW vs What i need it to look like) As you can see by the code, the real data is a little bigger. (At 680 rows and over 100 columns.) When I try running the code, it is failing when it goes to paste the range

Excel VBA: ODBC SQL server driver query timeout expired

≯℡__Kan透↙ 提交于 2021-02-17 06:30:49
问题 I have the below VBA query used in Excel 2016 that exacutes a MS Sql stored procedure, sometimes it executes smoothly and returns the recordset, but more often I get an error [Microsoft][ODBC SQL Server Driver] query timeout expired . At the same time when we go to SSMS and execute the query it runs without issues. This assumes the issue is rather caused by Excel/VB than by SQL or the query itself. Searching for this error results in checking network firewalls, but we tried on other machines

Exporting data from Excel to Word: data targets/placeholders

℡╲_俬逩灬. 提交于 2021-02-17 06:16:51
问题 In Excel I have a userform that has a ListBox being populated from an Excel table using RowSource=myTable. Now I want to select one line, press a button, and export every column from the selected row to different places on a Word document, which is a template with pre-formated text. Column1 should go to place1, column2 to place2, whatever I want... What data targets/placeholders are available in Word for inserting data? 回答1: Word has multiple possibilities for the developer to write data that

Can't assign array result of function to an array

浪子不回头ぞ 提交于 2021-02-17 06:07:30
问题 I'm trying to assign array result of function to an array. It works fine, if i try to assign one element of result array to my array, but it returns error while trying to assign whole result array to my array ("Can't assign to array"). Sub test() Dim lol(6) as Double lol = Hehe2() End Sub Function Hehe2() As Double() Dim Zliczacz(1 To 6) As Double Zliczacz(1) = 1 / 2 Zliczacz(2) = 1 / 2 Zliczacz(3) = 1 / 2 Zliczacz(4) = 1 / 2 Zliczacz(5) = 1 / 2 Zliczacz(6) = 1 / 2 Hehe2 = Zliczacz() End

Can't assign array result of function to an array

試著忘記壹切 提交于 2021-02-17 06:05:58
问题 I'm trying to assign array result of function to an array. It works fine, if i try to assign one element of result array to my array, but it returns error while trying to assign whole result array to my array ("Can't assign to array"). Sub test() Dim lol(6) as Double lol = Hehe2() End Sub Function Hehe2() As Double() Dim Zliczacz(1 To 6) As Double Zliczacz(1) = 1 / 2 Zliczacz(2) = 1 / 2 Zliczacz(3) = 1 / 2 Zliczacz(4) = 1 / 2 Zliczacz(5) = 1 / 2 Zliczacz(6) = 1 / 2 Hehe2 = Zliczacz() End

Can't assign array result of function to an array

五迷三道 提交于 2021-02-17 06:05:19
问题 I'm trying to assign array result of function to an array. It works fine, if i try to assign one element of result array to my array, but it returns error while trying to assign whole result array to my array ("Can't assign to array"). Sub test() Dim lol(6) as Double lol = Hehe2() End Sub Function Hehe2() As Double() Dim Zliczacz(1 To 6) As Double Zliczacz(1) = 1 / 2 Zliczacz(2) = 1 / 2 Zliczacz(3) = 1 / 2 Zliczacz(4) = 1 / 2 Zliczacz(5) = 1 / 2 Zliczacz(6) = 1 / 2 Hehe2 = Zliczacz() End

Hiding empty columns in a table in excel using VBA

馋奶兔 提交于 2021-02-17 05:59:27
问题 I have an excel sheet with a table and its quite large so I also have a slicer to break it up in viewable pieces. My problem is that then selecting a specific unit in the slicer sometimes there will be columns in the table that's empty. I would very much like to make a button to hide them (and then have another button to unhide so I can select other units in the slicer and view new data and so on...) My problem is that most VBA code online hides all the columns outside the table. Im not in

Hiding empty columns in a table in excel using VBA

浪子不回头ぞ 提交于 2021-02-17 05:59:06
问题 I have an excel sheet with a table and its quite large so I also have a slicer to break it up in viewable pieces. My problem is that then selecting a specific unit in the slicer sometimes there will be columns in the table that's empty. I would very much like to make a button to hide them (and then have another button to unhide so I can select other units in the slicer and view new data and so on...) My problem is that most VBA code online hides all the columns outside the table. Im not in