excel-2010

How to call VBA function from Excel cells (2010)?

佐手、 提交于 2019-12-17 07:27:41
问题 I defined a few functions in a workbook using VBA, and then expected to be able to use them in a cell formula - but Excel does not recognise the function. I just get #NAME? Tried: Realising I had created an XSLX file, I converted it to a XSLM file. Didn't work. Removed all types from the function declaration. Didn't work. Moved the function into the worksheet VBA module. Didn't work. Added Public to the declaration. Didn't work. What am I missing? This isn't clever code, either: Function

When one should use Set [e.g for SpecialCells return value]?

余生长醉 提交于 2019-12-17 06:57:06
问题 I am afraid I misunderstand the documentation of VBA for excel, I have this line which seems to be an error: Range a = Selection.SpecialCells(xlCellTypeConstants, 23) But this one is just fine: Set a = Selection.SpecialCells(xlCellTypeConstants, 23) The documentation claims: Returns a Range object that represents all the cells that match the specified type and value. But it actually returns a byRef object and that is why I have to use Set . What do I miss here? Here is Range.SpecialCells

Format excel column to decimal doing export from c#

大兔子大兔子 提交于 2019-12-17 02:53:03
问题 Hi I am exporting database to excel with below method as Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=" + FileName); Response.ContentType = "application/vnd.ms-excel"; EnableViewState = false; Response.Write("<style> TABLE { border:dotted 1px #999; } TH { border:dotted 1px #D5D5D5; text-align:center } TD { border:dotted 1px #D5D5D5; } </style>"); Response.Write("<table>"); Response.Write("<tr>"); Response.Write("<th>Actual

filter out multiple criteria using excel vba

雨燕双飞 提交于 2019-12-17 02:31:55
问题 I have 8 variables in column A, 1,2,3,4,5 and A, B, C. My aim is to filter out A, B, C and display only 1-5. I can do this using the following code: My_Range.AutoFilter Field:=1, Criteria1:=Array("1", "2", "3","4","5"), _ Operator:=xlFilterValues But what the code does is it filters variables 1 to 5 and displays them. I want to do the opposite, but yielding the same result, by filtering out A, B, C and showing variables 1 to 5 I tried this code: My_Range.AutoFilter Field:=1, Criteria1:=Array(

Getting ScriptControl to work with Excel 2010 x64

时光毁灭记忆、已成空白 提交于 2019-12-17 02:24:13
问题 I am trying to use the solution given to this, however, whenever I try to run the most basic anything, I get an Object not Defined error. I thought this would be my fault (not having installed ScriptControl). However, I tried installing as described in here, to no avail. I am running Windows 7 Professional x64 with Office 2010 64 bit. 回答1: Sadly, scriptcontrol is a 32bit component only and will not run inside a 64bit process. 回答2: You can create ActiveX objects like ScriptControl , which

Excel: How to transpose select columns and group by repeated values? (1D to 2D table)

℡╲_俬逩灬. 提交于 2019-12-14 03:43:11
问题 I am working with a data dump of transactions which is not exported from the particular system in a very friendly format for any purpose. The data in Excel is made up of approximately 700,000 rows currently, whereas once organised correctly should only consist of maybe 70,000, where the unique values of one particular column are transposed into some additional columns. Currently I am working with something like this (simplified) example below; Request_ID Status Field_Name Value 01000 Rejected

how to count increasing profit streak?

时光总嘲笑我的痴心妄想 提交于 2019-12-14 03:35:59
问题 I want to count how many years a company has increased the profit from now and in a continuing streak. Example here In the picture it has to count until 2014 because the profits have not been increased relative to 2013. For steady profits, it has to count until 2012 because in 2011 the profits were higher than after that. So these are the two calculations that should be done. Import is that it shouldn't count rows of years where the profits were 0 - 0 - 0 - 0 (=steady, but 0 is no profit at

VBA - How to copy row in Excel from one workbook to another?

三世轮回 提交于 2019-12-14 00:50:43
问题 Despite many posts I have looked through being of along the same lines as my question, none of the answers satisfy what I am looking for. If you can link me to one I'd gladly read it. I have a workbook with worksheets. For simplicity, let's say my workbook has a worksheet. And in my worksheet which is called "Sheet1", there is data in cells A1 to A4. What I want my VBA code to do is: Copy row 1 (or specifically cells A1 to A4) of Workbook 'A' into Range variable 'myRange' Create a new

Excel keep 1st three rows and delete rest of duplicates [closed]

喜夏-厌秋 提交于 2019-12-14 00:09:39
问题 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 3 years ago . I have 20K data sheet that contain multiple duplicates for column 1. I need to keep 1st three duplicates for column 1 for each number and delete rest of it. I need to keep the yellow highlighted and delete the rest of it. 回答1: So, going the VBA route, you'll need to loop through each row in your tab and test the

Entering Data into a spreadsheet through a UserForm in Excel

大憨熊 提交于 2019-12-13 22:13:33
问题 I am new to VBA in Excel, and I have a basic userform which is to place the data into the sheet. the data from the form is to enter in cell B13 through to G13, then every other entry after should be done on the next row down e.g. B14-G14. I have this code already however it isnt entering the data into the correct cell and is repeatedly entering it on the same row... Private Sub CommandButton1_Click() Dim lngWriteRow As Long Dim ws As Worksheet Set ws = Worksheets("Sheet1") lngWriteRow = ws