excel-vba

Remove cell from Range (object)

北城以北 提交于 2020-03-14 18:26:17
问题 Background My code does some loops over ranges, however, each interaction should be performed in the range excluding the cell just performed. I think the easier way to do so is to remove the cell from the stored range. Problem I have not been able to find a way to remove cell from the stored object Code The question is general but, for the matters it would be something like Sub Sample() Dim RangeToAnalyze As Range Dim CounterRange As Long Dim ExcludeCell As Range 'sample on what is desired to

Remove cell from Range (object)

白昼怎懂夜的黑 提交于 2020-03-14 18:24:51
问题 Background My code does some loops over ranges, however, each interaction should be performed in the range excluding the cell just performed. I think the easier way to do so is to remove the cell from the stored range. Problem I have not been able to find a way to remove cell from the stored object Code The question is general but, for the matters it would be something like Sub Sample() Dim RangeToAnalyze As Range Dim CounterRange As Long Dim ExcludeCell As Range 'sample on what is desired to

How to convert 32 bit VBA code into 64 bit VBA code

时光总嘲笑我的痴心妄想 提交于 2020-03-13 05:34:26
问题 Im trying to run a macro code but since I'm using a 64 bit Excel 2016 this code is not working. Please help me how to fix this. Private Declare Function FindWindowEx Lib "User32" Alias "FindWindowExA" _ (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _ ByVal lpsz2 As String) As Long Private Declare Function IIDFromString Lib "ole32" _ (ByVal lpsz As Long, ByRef lpiid As GUID) As Long Private Declare Function AccessibleObjectFromWindow Lib "oleacc" _ (ByVal hWnd As Long,

Using VBA in Excel to Google Search a keyword and return indexed pages on google

ε祈祈猫儿з 提交于 2020-03-06 10:50:10
问题 This question is very similar to Using VBA in Excel to Google Search in IE and return the hyperlink of the first result Only instead of a first link - is there any way to insert amount of indexed pages? example: 回答1: With minor modification to the original code we can capture the innerText of the resultStats div. The first column in the excel sheet has the string to be searched. Results like "About 1,660 results (0.17 seconds)" will be filled in the second column. In case you need only the

Using VBA in Excel to Google Search a keyword and return indexed pages on google

旧城冷巷雨未停 提交于 2020-03-06 10:47:29
问题 This question is very similar to Using VBA in Excel to Google Search in IE and return the hyperlink of the first result Only instead of a first link - is there any way to insert amount of indexed pages? example: 回答1: With minor modification to the original code we can capture the innerText of the resultStats div. The first column in the excel sheet has the string to be searched. Results like "About 1,660 results (0.17 seconds)" will be filled in the second column. In case you need only the

Opening and Saving new Workbooks - VBA

China☆狼群 提交于 2020-03-06 05:28:39
问题 So I know there have been questions on this before, but none seem to explicitly solve the problems I'm having. Effectively what I'm trying to do is create a new workbook, copy and paste data into it, and then save that new workbook under a new filename. No matter what I do, I seem to get various types of error messages. Here is my code. Any help is very appreciated! Private Sub DoStuff() CurrentFile = "June_Files_macros_new.xlsm" NewFile = "Train10_June01.xls" Workbooks.Add 'Save New Workbook

IF Function vba

孤街醉人 提交于 2020-03-06 04:09:49
问题 I need a macro that can do this: If column AB5 has a blank cell, then then column A5 will take the value from column U5. if column AB5 is not a blank cell (contains text), then column A5 will take the value from AC5. This will run for all the data at column AB I tried to use IF function, =IF(ISBLANK(AB5), U5, AC5) but it will reflect the wrong data if the cell contains text where they will still take U5 value. Ideally is if it can be done using macro, but IF function is also fine too! Please

IF Function vba

家住魔仙堡 提交于 2020-03-06 04:06:10
问题 I need a macro that can do this: If column AB5 has a blank cell, then then column A5 will take the value from column U5. if column AB5 is not a blank cell (contains text), then column A5 will take the value from AC5. This will run for all the data at column AB I tried to use IF function, =IF(ISBLANK(AB5), U5, AC5) but it will reflect the wrong data if the cell contains text where they will still take U5 value. Ideally is if it can be done using macro, but IF function is also fine too! Please

Excel VBA Sort, error 1004 on .Apply

时间秒杀一切 提交于 2020-03-06 00:58:52
问题 I'm having issues using sort in VBA. I saw this thread for which the answers don't work for me : Sort in VBA I believe there is a maximum nr of records on which you can sort. Is that correct? I want to sort on 4 criteria in a sheet/table with 188,000 records. I always get an error on the .Apply statement: "run-time error '1004': application-defined or object-defined error" Below my code: Sub Sort_Table() Dim sht As Worksheet Set sht = ActiveWorkbook.Worksheets("Sheet1") sht.Activate With sht

Random row selection in multiple excel sheets

試著忘記壹切 提交于 2020-03-04 23:10:10
问题 I have an output excel file from another macro which has multiple sheets (named 100,101,102... etc.) Sheet numbers will vary depending on prior macro's output. Also there is a sheet named sheet1 which has info about how many random rows should be selected from 100,101,102... etc. I tried to merge/combine what i could find from similar macros but i guess the loop part is way over my head. I will run the macro from another "main" excel. which will open related output xls. Then it will lookup