excel

Number of rows based on the cell value (loop with copy)

杀马特。学长 韩版系。学妹 提交于 2021-02-08 04:49:33
问题 I would like to sync my address list with the number shown in the cell at the front sheet. The situation looks as follows: In the cell D41 I have the number of flats. Now, when I open the "Address list" sheet I want to have the first row instantly copied 40 times down (marked with red). I know, that it can be described as a loop, this is why I tried this code: Original source here: Relocation of multiple images with ID changing Private Sub AddressList() Dim i As Long Dim rg As Range, rg2 As

Number of rows based on the cell value (loop with copy)

戏子无情 提交于 2021-02-08 04:49:20
问题 I would like to sync my address list with the number shown in the cell at the front sheet. The situation looks as follows: In the cell D41 I have the number of flats. Now, when I open the "Address list" sheet I want to have the first row instantly copied 40 times down (marked with red). I know, that it can be described as a loop, this is why I tried this code: Original source here: Relocation of multiple images with ID changing Private Sub AddressList() Dim i As Long Dim rg As Range, rg2 As

accessing individual array elements in VBA function

前提是你 提交于 2021-02-08 04:49:18
问题 VBA newbie here. I am trying to pass an array ( it is static, but please answer for dynamic range as well ) to a function. Then assign individual array elements to unique variables and use these variables in a custom formula. I just browsed around and wrote the code but keep getting #VALUE! error. The gist of the code is below: Public Function mytest(ByRef arr1 As Range) Dim A As Double Dim B As Double A = arr1(0) B = arr1(1) mytest = A + B 'The actual formula is a bit more complicated than

Align numerical precision Excel 2013 and R

最后都变了- 提交于 2021-02-08 04:47:38
问题 It is a rather broad question, but I replicated an Excel model in R. R produces almost the same results as excel, but there is always a slight % deviation in the range of 10^-8. I assume this is due to numerical precision. The model uses only basic arithmetic operations. My question would be: is there a simple way to force R to use the same numerical precision as Excel? 回答1: Probably not. R always uses double-precision (i.e., 8-byte) floating point, and and it seems that's also what Excel

Align numerical precision Excel 2013 and R

扶醉桌前 提交于 2021-02-08 04:47:31
问题 It is a rather broad question, but I replicated an Excel model in R. R produces almost the same results as excel, but there is always a slight % deviation in the range of 10^-8. I assume this is due to numerical precision. The model uses only basic arithmetic operations. My question would be: is there a simple way to force R to use the same numerical precision as Excel? 回答1: Probably not. R always uses double-precision (i.e., 8-byte) floating point, and and it seems that's also what Excel

Reproducing Excel's LINEST function with NumPy

≯℡__Kan透↙ 提交于 2021-02-08 04:45:54
问题 I have to use Excel's LINEST function to compute error in my linear regression. I was hoping to reproduce the results using Numpy's polyfit function. I was hoping to reproduce the following LINEST usage: LINEST(y's, x's,,TRUE) with polyfit. I'm not sure how I can get the two functions to produce the same values because nothing I've tried gives similar results. I tried the following: numpy.polyfit(x,y,3) and various other values in the third position. 回答1: This question is actually a result of

Copy excel sheet from one worksheet to another in Python

六眼飞鱼酱① 提交于 2021-02-08 04:41:43
问题 All I want to do is copy a worksheet from an excel workbook to another excel workbook in Python. I want to maintain all formatting (coloured cells, tables etc.) I have a number of excel files and I want to copy the first sheet from all of them into one workbook. I also want to be able to update the main workbook if changes are made to any of the individual workbooks. It's a code block that will run every few hours and update the master spreadsheet. I've tried pandas, but it doesn't maintain

Sorting a vector in Excel VBA

回眸只為那壹抹淺笑 提交于 2021-02-08 04:29:15
问题 I'm VERY new to Excel VBA. I want to write a function that offsets the cells in the current vector (the range selected by the user) by an amount also specified by the user. The cells must be moved up out of the array by "n", and must then be displayed at the bottom of the same array after the remaining cells have moved up to take the place of the cells shifted up and out of the array. Any advice will be greatly appreciated, the current code I wrote is not working and I know too little to help

VLOOKUP() Alternative using Arrays

Deadly 提交于 2021-02-08 03:48:52
问题 I’ve been experimenting with arrays in an effort to find a faster alternative to VLOOKUP(), which can take a long time to execute with very large data sets. Arrays are not my forte, and I’m stuck on the code below. I have searched SO and many other sites, grabbing snippets of code here and there, but I’ve hit a brick wall when it comes to putting it all together. The data is simply: A1:A5 the list of values to lookup (1,2,3,4,5) C1:C5 the range to ‘find’ the values (2,4,6,8,10) D1:D5 the

Optimize performance of Removing Hidden Rows in VBA

99封情书 提交于 2021-02-08 03:42:25
问题 I am using the following code to remove hidden/filtered lines after applying autofilters to a big sheet in VBA (big means roughly 30,000 rows): Sub RemoveHiddenRows() Dim oRow As Range, rng As Range Dim myRows As Range With Sheets("Sheet3") Set myRows = Intersect(.Range("A:A").EntireRow, .UsedRange) If myRows Is Nothing Then Exit Sub End With For Each oRow In myRows.Columns(1).Cells If oRow.EntireRow.Hidden Then If rng Is Nothing Then Set rng = oRow Else Set rng = Union(rng, oRow) End If End