excel-2013

Putting an Excel UDF into the Worksheet object (as opposed to in a module)

烂漫一生 提交于 2020-07-16 02:39:13
问题 I suspect the answer is "not possible" - but there is no harm in asking this fine community! I have a Excel 2013 UDF (User Defined Function) that is unique to a certain worksheet. Currently, I have this UDF in a "Module" in the containing Workbook. But what I would like to do, is to place the UDF code in the "Worksheet Object" so it is only available to that particular Worksheet. I have tried, of course, but it is not visible, so I naturally get a #NAME? error. I've tried prefacing the

Putting an Excel UDF into the Worksheet object (as opposed to in a module)

梦想与她 提交于 2020-07-16 02:36:37
问题 I suspect the answer is "not possible" - but there is no harm in asking this fine community! I have a Excel 2013 UDF (User Defined Function) that is unique to a certain worksheet. Currently, I have this UDF in a "Module" in the containing Workbook. But what I would like to do, is to place the UDF code in the "Worksheet Object" so it is only available to that particular Worksheet. I have tried, of course, but it is not visible, so I naturally get a #NAME? error. I've tried prefacing the

Putting an Excel UDF into the Worksheet object (as opposed to in a module)

心不动则不痛 提交于 2020-07-16 02:36:25
问题 I suspect the answer is "not possible" - but there is no harm in asking this fine community! I have a Excel 2013 UDF (User Defined Function) that is unique to a certain worksheet. Currently, I have this UDF in a "Module" in the containing Workbook. But what I would like to do, is to place the UDF code in the "Worksheet Object" so it is only available to that particular Worksheet. I have tried, of course, but it is not visible, so I naturally get a #NAME? error. I've tried prefacing the

VBA Loop through textbox controls in userform

此生再无相见时 提交于 2020-07-10 08:46:09
问题 I have looked through numerous posts on looping through UserForm Controls but cant seem to adjust the code i have found for my needs and need some help. Scenario I am trying to figure out: I have 44 text boxes on a userform whose names all start with "ch" example "chTextBox1" When the userform activates I need to loop through all of the text boxes that start with "ch" and change the background color of those textboxes to a color based on the interior color of a cell Below is the code that I

Method 'Copy' of object 'Sheets' failed

試著忘記壹切 提交于 2020-07-09 19:15:29
问题 After reinstalling Office 2013 I got this error: Run-time error '-21474178848 (80010108)': Method 'Copy' of object 'Sheets' failed In this the code block: Set ThisWork = ActiveWorkbook strExt = ThisWork.Sheets("Catalog1").Cells(2, 4).Value & "_" & Format(Now, "yyyy_mm_dd_hhmmss") strSaveName = ThisWork.Path & "\" & strExt & ".xlsx" ThisWork.Sheets(Array("Catalog1", "Catalog2", "Translations")).Copy With ActiveWorkbook ... After pressing debug and pressing Continue ( F5 ), Excel crashes. Why

VBA retrieve hyperlink target sheet?

浪尽此生 提交于 2020-07-09 08:55:14
问题 I'm trying to retrieve the sheet reference location from a hyperlink that's in a cell The following doesn't seem to work as test doesn't return anything, even though G8 points to Sheet: KO in Cell A19 test = Range("G8").Hyperlinks(3).Address Now if I run the following: For Each hl In Sheets("LIST").Hyperlinks MsgBox "Range " & hl.Range.Address & " addr " & _ hl.Address & " text " & hl.TextToDisplay Next hl It cycles through and finds the correct address but I can't seem to work out how to

Always Allow Native DB Queries

ぃ、小莉子 提交于 2020-05-11 07:36:09
问题 In Excel 2013 how can I change options (or is it possible) to always allow native DB Queries? Can someone walk me through how to set this up? 回答1: When in Excel 1) Click Power Query from the "Ribbon" across the top 2) Choose Options 3) From the Options Window that loads select Security from the left 4) Untick the box that says "Require user approval for new native database queries" 5) Click OK 回答2: I don't yet have a high enough reputation to comment this on user2676140's answer, but to

Always Allow Native DB Queries

ぐ巨炮叔叔 提交于 2020-05-11 07:36:04
问题 In Excel 2013 how can I change options (or is it possible) to always allow native DB Queries? Can someone walk me through how to set this up? 回答1: When in Excel 1) Click Power Query from the "Ribbon" across the top 2) Choose Options 3) From the Options Window that loads select Security from the left 4) Untick the box that says "Require user approval for new native database queries" 5) Click OK 回答2: I don't yet have a high enough reputation to comment this on user2676140's answer, but to

Invalidate Ribbon Control Without Module-Level Variables

£可爱£侵袭症+ 提交于 2020-05-10 20:01:52
问题 I've developed an Excel add-in that includes a custom ribbon. I'd like to be able to invalidate (enable/disable) a control on the ribbon in certain situations, but every example I can find uses a module-level or global variable to store the ribbon object when the ribbon is first loaded. This seems like a good way to do it, but, as listed here, there are instances when variables can empty. So I'm wondering, is there a different way to achieve the result of enabling/disabling a control in an

VBA for Excel throws “Object variable or with block variable not set” when there is no Object

落爺英雄遲暮 提交于 2020-03-17 10:35:51
问题 In my code, I have declared these variables: Dim Field_Name, Datatype, row As Integer Then, inside a For loop, I have this code: Field_Name = Worksheets(i).UsedRange.Find("Field Name").Column Datatype = Worksheets(i).UsedRange.Find("Datatype").Column row = Worksheets(i).UsedRange.Find("Field Name").row + 1 However, that code throws the "Object variable or with block variable not set" run-time error. According to the API, the Range.Column and Range.row property is a read-only Long. I have