vba

Application.WorksheetFunction vs. WorksheetFunction

五迷三道 提交于 2021-02-05 07:35:43
问题 This one is a rather short question and probably easy to answer, however I fail to do so myself at this point: Sample data: A B C Sample code: With Sheet1 Debug.Print Application.WorksheetFunction.Match("D", .Columns(1), 0) 'Option1 Debug.Print Application.Match("D", .Columns(1), 0) 'Option2 Debug.Print WorksheetFunction.Match("D", .Columns(1), 0) 'Option3 End With Question: I know that option2 lost intellisense and will not go into debug mode, however option1 and option3 behave the same

How to keep macro running when there are protected sheets?

烈酒焚心 提交于 2021-02-05 07:16:56
问题 I have protected sheets 4 with a password because there are some cells that users aren't allowed to input in those cells in sheet 4. The password is 1234. But, I want to run my macro, and if there is an error, the cell will be highlight automatically. My macro doesn't run and error, because the cell that I want to highlight is in protected sheet. How to make the sheet 4 stay protected and make my macro keep running when I click the validation button? Private Sub commandbutton1_click()

VBA Excel: how to get row and column number of named range?

久未见 提交于 2021-02-05 07:01:07
问题 I have the following problem and it's driving me NUTS! I work on a large database program in Excel, and I'm trying to retrieve the row and column numbers of specific named ranges. The following code used to work (temp_entryvalue is the name of the range): temp_datafile_row = Workbooks(datafile_filepath).Worksheets(temp_datafile_worksheet).Range(temp_entryvalue).Row temp_datafile_col = Workbooks(datafile_filepath).Worksheets(temp_datafile_worksheet).Range(temp_entryvalue).Column I get the ole'

Compile Error “Expected: =” when calling another procedure

大憨熊 提交于 2021-02-05 06:46:06
问题 I try to call a procedure giving to arguments, it throws a compile error stating "Expected: =". ... Dim isWorkaround As Boolean isWorkaround = False If Check101.Value = True Then isWorkaround = True End If ... 'Procedure I try to call ElseIf Combo_Report_Selection = "Adjusted Report" And Combo_someOther= "Other" Then Call_01_Adj_Report(div, isWorkaround) ElseIf Combo_Report_Selection = "Upload Log" Then Call_03_Upload_Log ElseIf Combo_Report_Selection = "Gather Summary" Then Call_04_Adj

VBA Workshhet Change - Limit the Change Just For Specific Range

百般思念 提交于 2021-02-05 05:54:49
问题 I have a trigger that I want to use in certain worksheet - just inside 2 specific columns. But whan I enter a value inside another range it triggers the Private Sub of that worksheet. I want it would start to work just whan I cange value within columns E or H. Is someone knows how to do it right? Private Sub Worksheet_Change(ByVal Target As Range) Dim LR As Long Dim rng1 As Range Dim rng2 As Range 'WE WANT TO KEEP THE TARGET COLUMNS BETWEEN 0% TO 100% LR = Cells(Rows.Count, "A").End(xlUp).Row

Remove a non-existant Sheet in VBA

我怕爱的太早我们不能终老 提交于 2021-02-05 05:14:16
问题 I have sheets listed in an Excel Workbook that don't actually exist. The sheets are listed when you view code and are looking at the list of sheets in the VBA part, but they don't actually exist in the workbook at all. They also aren't hidden, in case someone is thinking of that. These sheets also don't have a name after them in parentheses and look like the same icon as ThisWorkbook. I have no way to delete them and have been trying. Does anyone have any suggestions on how to delete them

Remove a non-existant Sheet in VBA

南楼画角 提交于 2021-02-05 05:11:24
问题 I have sheets listed in an Excel Workbook that don't actually exist. The sheets are listed when you view code and are looking at the list of sheets in the VBA part, but they don't actually exist in the workbook at all. They also aren't hidden, in case someone is thinking of that. These sheets also don't have a name after them in parentheses and look like the same icon as ThisWorkbook. I have no way to delete them and have been trying. Does anyone have any suggestions on how to delete them

Remove a non-existant Sheet in VBA

家住魔仙堡 提交于 2021-02-05 05:10:19
问题 I have sheets listed in an Excel Workbook that don't actually exist. The sheets are listed when you view code and are looking at the list of sheets in the VBA part, but they don't actually exist in the workbook at all. They also aren't hidden, in case someone is thinking of that. These sheets also don't have a name after them in parentheses and look like the same icon as ThisWorkbook. I have no way to delete them and have been trying. Does anyone have any suggestions on how to delete them

Remove a non-existant Sheet in VBA

☆樱花仙子☆ 提交于 2021-02-05 05:08:27
问题 I have sheets listed in an Excel Workbook that don't actually exist. The sheets are listed when you view code and are looking at the list of sheets in the VBA part, but they don't actually exist in the workbook at all. They also aren't hidden, in case someone is thinking of that. These sheets also don't have a name after them in parentheses and look like the same icon as ThisWorkbook. I have no way to delete them and have been trying. Does anyone have any suggestions on how to delete them

Remove a non-existant Sheet in VBA

霸气de小男生 提交于 2021-02-05 05:08:23
问题 I have sheets listed in an Excel Workbook that don't actually exist. The sheets are listed when you view code and are looking at the list of sheets in the VBA part, but they don't actually exist in the workbook at all. They also aren't hidden, in case someone is thinking of that. These sheets also don't have a name after them in parentheses and look like the same icon as ThisWorkbook. I have no way to delete them and have been trying. Does anyone have any suggestions on how to delete them