excel-2010

Calling a userform and returning a value

℡╲_俬逩灬. 提交于 2019-11-27 07:47:11
问题 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

IF statement: how to leave cell blank if condition is false (“” does not work)

纵饮孤独 提交于 2019-11-27 05:15:50
问题 I would like to write an IF statement, where the cell is left blank if the condition is FALSE. Note that, if the following formula is entered in C1 ( for which the condition is false ) for example: =IF(A1=1,B1,"") and if C1 is tested for being blank or not using =ISBLANK(C1) , this would return FALSE , even if C1 seems to be blank. This means that the =IF(A1=1,B1,"") formula does not technically leave the cells blank if the condition is not met. Any thoughts as to a way of achieving that?

Excel error 1004 “Unable to get … property of WorksheetFunction class” appearing inconsistently

不问归期 提交于 2019-11-27 05:15:48
I have a VBA function within a spreadsheet which operates on another spreadsheet that is opened in an earlier stage of my macro. The macro used to work fine but just recently has started causing a 1004 error ( "Unable to get RoundDown property of the WorksheetFunction class" ) when it runs. I believe I understand what the error would be caused by (a problem running RoundDown) but I cannot see why it is getting triggered in my macro and the odd part is that when I go into Debug mode and step through the code in the VBE the error does not recur (despite nothing obviously changing). Does anyone

Conditional formatting, entire row based

江枫思渺然 提交于 2019-11-27 05:01:25
问题 I've searched and read through answers related to conditional formatting, but I can't seem to get mine to work, so maybe I'm doing something wrong. I have a worksheet for work. It contains a list of animals in our shelter. What I'm attempting to do is color the entire row green if they've been adopted (noted by an "X" in column "G"). I've had =$G$2="X" and =$G2="X" , but neither work. It'll only color the one row that was active when I set the rule, and when I enter "X" in another row, it

how to split one column into two columns base on conditions in EXCEL

孤人 提交于 2019-11-27 04:54:32
问题 I am very new to Excel. Please help Column1 A,1 B,2 C,1 D,2 E,1 output: Column2 Column3 A,1 B,2 C,1 D,2 E,1 what is the formula to do this? Thanks! 回答1: Assuming your data (" A,1 , etc.") spans cells A1:A50, then: Cell B1: =INDEX($A$1:$A$50,ROW()*2-1,1) Cell C1: =INDEX($A$1:$A$50,ROW()*2,1) Then you can copy the formulas to cells below, as far as needed. These formulas "redistribute" your cells contents between the two columns, regardless of the text itself. 回答2: You can use an IF condition

Excel VBA Project has generated multiple Workbook objects

跟風遠走 提交于 2019-11-27 04:47:05
问题 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

Error setting PlotArea.Width in Excel, VBA (Excel 2010)

两盒软妹~` 提交于 2019-11-27 04:39:49
问题 I am experiencing an error in a subroutine attempting to set the plotarea.width property of a chart. The other dimensions also cause this error if I comment out the preceding line(s). There is no ActiveChart, no selection, etc. The specific error message is this: "-2147467259 (80004005) Method 'Width' of object 'PlotArea' failed" This is stumping me for several reasons: In debug mode, F8 to step through the code the error does NOT occur. AFAIK "width" is not a "method" but a "property" of the

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

这一生的挚爱 提交于 2019-11-27 04:36:15
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 Square2(AnyNumber) 'return the square of any integer Square2 = AnyNumber * AnyNumber End Function Adahus

How to highlight a cell using the hex color value within the cell?

柔情痞子 提交于 2019-11-27 04:15:31
I have a spreadsheet of symbols and matching hex colors. I want to fill the cell itself (or the one next to it) with the hex color within the cell. I've read a bit about "conditional formatting", and I think that's the way to do it. How might I achieve the result I would like? pnuts Can't be achieved with Conditional Formatting for all colours. Assuming: Row1 contains Data Labels, data set does not have gaps, the HEX colour is for the fill not the font, you have parsed the HEX colour values (numbers, not formulae) into Columns C:E (R,G,B) and that you do not require to do this often, then the

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

一曲冷凌霜 提交于 2019-11-27 03:44:44
问题 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? 回答1: By referring this(http://www.excelforum.com/excel-programming-vba-macros