excel-vba

Expected End of Statement

微笑、不失礼 提交于 2020-01-21 18:16:15
问题 Ok, I have used a formula that was suggested that works well, should work without an issue but now I am getting this error: Expected End of Statement Here is the formula Range("B4").FormulaR1C1 = "=IF(RC[-1]="T",VLOOKUP(RC[7],treatlookup,11,FALSE),VLOOKUP(RC[7],itemlookup,22,FALSE))" Not sure what is going on, why it is happening. Any suggestions. Thanks, 回答1: Escape the embedded double-quotes ( "T" ) by doubling them ( ""T"" ): Range("B4").FormulaR1C1 = "=IF(RC[-1]=""T"",VLOOKUP(RC[7]

Excel VBA Run-time error '13': Type mismatch

时光总嘲笑我的痴心妄想 提交于 2020-01-21 15:07:24
问题 I'm not great at VBA, but all of a sudden, I started getting this error. Please let me know if you can find what the error is. I'm so stuck on this one. I did search everywhere and found lots of similar posts but the solution always seems to be very specific to the code. Any of you experts would be greatly appreciated. Here's my code: Sub FindSimilar() Dim phrases As Range, phrase As Range Dim terms As Range, term As Range Dim matches As String Dim words() As String 'ensure this has the

Filling Internet Explorer inputbox

坚强是说给别人听的谎言 提交于 2020-01-21 11:34:08
问题 I read so many answers to my problem but somehow if I try to "mimic" what I see, I still am not able to do what I need. The problem is very simple: fill an inputbox on an opened IE page. Result: the code gets stuck on the line with getelementbyid showing runtime error 424 (object required). Private Sub AddInfoFromIntranet() Dim ie As Object Set ie = CreateObject("internetexplorer.application") Application.SendKeys "{ESC}" ' I need this to ignore a prompt With ie .Visible = True .navigate "

Filling Internet Explorer inputbox

回眸只為那壹抹淺笑 提交于 2020-01-21 11:33:35
问题 I read so many answers to my problem but somehow if I try to "mimic" what I see, I still am not able to do what I need. The problem is very simple: fill an inputbox on an opened IE page. Result: the code gets stuck on the line with getelementbyid showing runtime error 424 (object required). Private Sub AddInfoFromIntranet() Dim ie As Object Set ie = CreateObject("internetexplorer.application") Application.SendKeys "{ESC}" ' I need this to ignore a prompt With ie .Visible = True .navigate "

Filling Internet Explorer inputbox

早过忘川 提交于 2020-01-21 11:33:07
问题 I read so many answers to my problem but somehow if I try to "mimic" what I see, I still am not able to do what I need. The problem is very simple: fill an inputbox on an opened IE page. Result: the code gets stuck on the line with getelementbyid showing runtime error 424 (object required). Private Sub AddInfoFromIntranet() Dim ie As Object Set ie = CreateObject("internetexplorer.application") Application.SendKeys "{ESC}" ' I need this to ignore a prompt With ie .Visible = True .navigate "

Filling Internet Explorer inputbox

南楼画角 提交于 2020-01-21 11:33:06
问题 I read so many answers to my problem but somehow if I try to "mimic" what I see, I still am not able to do what I need. The problem is very simple: fill an inputbox on an opened IE page. Result: the code gets stuck on the line with getelementbyid showing runtime error 424 (object required). Private Sub AddInfoFromIntranet() Dim ie As Object Set ie = CreateObject("internetexplorer.application") Application.SendKeys "{ESC}" ' I need this to ignore a prompt With ie .Visible = True .navigate "

How to set up vba code for only one sheet?

折月煮酒 提交于 2020-01-21 11:26:12
问题 I am currently stuck trying to build a button that will run a sumifs macro. I am trying to build the button in Sheet1 and have the sumifs execute on Sheet2 . What I currently have is: Option Explicit Sub Sumifs() Dim Sht2 As Worksheet Dim EndRow As Long Dim i As Integer Dim SumRange As Range Dim CrtA As Range Dim CrtB As Range With Sht1 EndRow = Cells(Rows.Count, "A").End(xlUp).Row End With Set Sht2 = Worksheets("Sheet2") Set SumRange = Worksheets("Sheet3").Range("L5:L10") Set CrtA =

VBA - Close workbook after acquiring necessary information

拈花ヽ惹草 提交于 2020-01-21 09:42:09
问题 Your assistance is required on solving this world (Excel VBA) problem. I am using a VBA to populate an immense workbook (500 Cells per row), from a bucket load of workbooks(Qty=96). The VBA I am using got created by [@Kevin][1] and it works for about 20 files until my pc runs out of memory and crashes Excel. This kind of works great for working with such an immense amount of cells per workbook, because opening and closing each workbook adds up to the process quite a lot. Opening each work

Excel MATCH character limit

余生颓废 提交于 2020-01-21 09:12:31
问题 I use the following formula =INDEX(Dict!A:A,MATCH(A2,Dict!A:A,0),1) but MATCH only works with text below 256 characters. Any way to overcome this limitiation? 回答1: To accommodate partial matches use SEARCH like this: =INDEX(Dict!A:A,MATCH(TRUE,INDEX(ISNUMBER(SEARCH(A2,Dict!A:A)),0),0)) That will work to return a value > 256 characters but A2 can't be > 256 characters 回答2: You can use the LDMP look-up method, taking advantage of the concat formula available since the Excel 2016. ={CONCAT(IF

Using “If cell contains” in VBA excel

亡梦爱人 提交于 2020-01-21 07:38:28
问题 I'm trying to write a macro where if there is a cell with the word "TOTAL" then it will input a dash in the cell below it. For example: In the case above, I would want a dash in cell F7 (note: there could be any number of columns, so it will always be row 7 but not always column F). I'm currently using this code, but it's not working and I can't figure out why. Dim celltxt As String Range("C6").Select Selection.End(xlToRight).Select celltxt = Selection.Text If InStr(1, celltext, "TOTAL") > 0