excel-2010

PivotCache.Create unable to handle large Range

假如想象 提交于 2019-11-28 14:25:51
This run ok: Dim pc As PivotCache With tgtBook.Sheets("Data") Set pc = tgtBook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Range("A1:B5"), Version:=Excel.xlPivotTableVersion14) ' Range("myMthdata")) End With The throws a Run-time error '13' Type mismatch: Dim pc As PivotCache With tgtBook.Sheets("Data") Set pc = tgtBook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Range("A1:B500000"), Version:=Excel.xlPivotTableVersion14) ' Range("myMthdata")) End With The only difference is the number of rows in the SourceData. Is this a bug or is there a logical reason behind this

Excel VBA Find last row in range

末鹿安然 提交于 2019-11-28 13:43:49
im having a little trouble with finding the last row. What i am trying to do is find the last row in column "A", then use that to find the last row within a range. Example of Data: 1) LR_wbSelect = wbshtSelect.cells(Rows.count, "A").End(xlUp).Row - 22 2) LR_wbSelectNew = wbshtSelect.cells(LR_wbSelect, "A").End(xlUp).Row I am using the last row in column "A" as the data from row 29 down will always be the same length, the rows used in column "B" from row 29 can be a varying number of rows. So i am trying to use LR_wbSelect in column "A" to get my starting last Row, then within LR_wbSelectNew

Calling a userform and returning a value

我只是一个虾纸丫 提交于 2019-11-28 13:37:14
I have a vba code thats Auto_Open. It does some checks then prompts a userform that asks for username and password. I called this userform with userform_name.show . My issue is how can I return a Boolean to my Auto_Open sub from the userform code. I linked the code that verifies if the credentials are correct to the "Login" button on the form. this is the code that produces the Boolean. I need to return it to the Auto_Open. Private Sub loginbutton() Dim bool As Boolean Dim lrup Dim r As Long Dim pass As String loginbox.Hide 'are fields empty Do While True If unBox.Text = "" Or pwBox.Text = ""

Cells reference not working in Excel VBA 2010 Function

陌路散爱 提交于 2019-11-28 13:02:31
I am attempting to write a function that takes a range of data and calculates the ratio of two numbers from the columns provided by the user. I want to print this ratio out at the end of the row, but for some reason I am not able to reference the last cell in the row using the cells function. Instead, the Cells function just keeps providing me the value of that cell and not the cell address. I thought that the cells function provides the address as well. Can someone tell me if this wrong or if my code is wrong? Here is the code Function calculateRatio(table As Range, numerator As Integer,

Excel VBA Project has generated multiple Workbook objects

落花浮王杯 提交于 2019-11-28 12:12:07
I am responsible for a very large Excel 2010 spreadsheet with links to all sorts of external data sources including Bloomberg, 65 worksheets with vba modules and references to other vba add-ins. I have noticed that the VBA project has acquired multiple Workbook Objects. There's the standard ThisWorkbook. However, a number of the worksheets have also been turned into Workbook objects by Excel, leaving the original worksheet as a copy of the previous one, minus the code. This doesn't appear to be a result of anyone's actions. Indeed, I didn't think it possible to have more than one Workbook

Writing into Range.FormulaArray gives me a #NAME! error

隐身守侯 提交于 2019-11-28 11:52:04
问题 Nothing really fancy here, altough I need to split the formula in 2 because it is longer than 255 characters (sources: http://www.dicks-blog.com/archives/2005/01/10/entering-long-array-formulas-in-vba/ http://support.microsoft.com/kb/213181). f1 = "=SI(1=1,SOMME(SI(mySheet!$R:$R = ""something"",SI(mySheet!$AQ:$AQ = AM$1, NBCAR(Incidents!$AP:$AP)-NBCAR(SUBSTITUE(mySheet!$AP:$AP,$B2,"""")))))/NBCAR($B2)-X_X_X())" f2 = "SOMME(SI(mySheet!$R:$R = """",SI(mySheet!$AQ:$AQ = AM$1, SI(mySheet!$AM:$AM

How to use powershell to copy several excel worksheets and make a new one?

做~自己de王妃 提交于 2019-11-28 11:43:50
I have about 70 excel files I want to combine into a single document. Each document has only one sheet and follows this format: Row A with Columns A-F of headings Row B with the first entry Row C with the second entry Up to 150 rows on some sheets I want to scrape the information from Columns A-F for each row, and combine it into a new file with the information from all of the other files I have in the same directory. Note: I only want to capture Columns A-F since in Column G there exists a Yes, No dataset to manage the drop down list in Column F. I tried using dugan's answer from Copy Excel

Conditional formatting: using row() inside indirect() inside and() doesn't work. What am I doing wrong?

南笙酒味 提交于 2019-11-28 11:34:52
问题 Say I have set a value of 55 on cell B2. If it's value is 55, the cell's background color should be green. So I created a new rule using a formula by selecting "User a formula to determine which cells to format" and set the formula to the following: =B2 = 55 It worked, obviously. But because we don't want to hard-code the row because we are using this spreadsheet as a template in an application that generates more rows by simply copying that cell to another row, I set the formula to this one:

How to select clear table contents without destroying the table?

亡梦爱人 提交于 2019-11-28 10:54:38
I have a vba function in excel 2010 that I built using help from people on here. This function copies the contents of a table/form, sorts them, and sends them to the appropriate tables. Now after running this function I want the original table to be cleared. I can achieve this with the following code, assuming ACell has been defined as the first cell in the table. ACell.ListObject.Range.ClearContents works fine, the only problem is it deletes the table as well as the data values. Is there any way around this? I would rather not have to set the table up every time I enter some data. Doug Glancy

What exactly is the function of Application.CutCopyMode property in Excel

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 10:42:40
Well first of all I found couple of answers while googling but most of the forums are blocked in my Office Network hence asking this question here! One more intention is to get an answer in plain English :P I understand if we set Application.CutCopyMode = False then the Copied/Cut results will be vanished (i.e. memory will be cleared) but when should we use this and when not to use this? Can anyone please help? By referring this( http://www.excelforum.com/excel-programming-vba-macros/867665-application-cutcopymode-false.html ) link the answer is as below: Application.CutCopyMode=False is seen