excel

VBA: How to search for * using Find?

给你一囗甜甜゛ 提交于 2021-02-05 12:17:59
问题 I am trying to search for the string ** in a column in a worksheet, but I have trouble making this work as * also works as a wildcard when using find. To complicate it further the same column also includes *, so I need to find ** specifically. I have tried the below code so far, and in both cases it appears to find the first non-empty cell, which happens to be *. Set searchRange = Workbooks(fileName).Worksheets(1).Range("B:B").Find(Chr(42) & Chr(42), LookAt:=xlWhole) Alternatively: Set

VBA: How to search for * using Find?

我是研究僧i 提交于 2021-02-05 12:16:18
问题 I am trying to search for the string ** in a column in a worksheet, but I have trouble making this work as * also works as a wildcard when using find. To complicate it further the same column also includes *, so I need to find ** specifically. I have tried the below code so far, and in both cases it appears to find the first non-empty cell, which happens to be *. Set searchRange = Workbooks(fileName).Worksheets(1).Range("B:B").Find(Chr(42) & Chr(42), LookAt:=xlWhole) Alternatively: Set

Excel - Find duplicates in one column then sum quantities into another column?

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-05 12:15:24
问题 Find duplicates in one column then sum quantities into another column DATA RESULT A 1 A 11 A 1 B 7 A 9 C 5 B 2 D 4 B 2 E 8 B 3 C 5 D 4 E 7 E 1 回答1: For EXCEL 365 (or the Excel web app) : In C1 enter: =UNIQUE(A1:A10) in D1 enter: =SUMIF(A1:A10,C1#,B1:B10) EDIT#1: If VBA is acceptable to you, then try: Public Function unikue(rng As Range) Dim arr, c As Collection, r As Range Dim nCall As Long, nColl As Long Dim i As Long Set c = New Collection nCall = Application.Caller.Count On Error Resume

Excel workbook gets opened repeatedly after closing

不打扰是莪最后的温柔 提交于 2021-02-05 12:05:25
问题 I have used the method Application.ontime() for scheduling some macros.After closing the workbook, it gets opened again and again. to overcome this problem, I set another event on workbook- BeforeClosed. Now it is showing runtime error 1004:Method 'OnTime' of 'Object'_Application failed.I am not getting why this happening even after reffering the help context from web. Below code is given. Private Sub Workbook_Open() starttime = Now + TimeValue("00:02:00") Application.OnTime EarliestTime:

Excel workbook gets opened repeatedly after closing

限于喜欢 提交于 2021-02-05 12:04:50
问题 I have used the method Application.ontime() for scheduling some macros.After closing the workbook, it gets opened again and again. to overcome this problem, I set another event on workbook- BeforeClosed. Now it is showing runtime error 1004:Method 'OnTime' of 'Object'_Application failed.I am not getting why this happening even after reffering the help context from web. Below code is given. Private Sub Workbook_Open() starttime = Now + TimeValue("00:02:00") Application.OnTime EarliestTime:

Save as pdf using Mac Excel VBA

[亡魂溺海] 提交于 2021-02-05 11:51:27
问题 My Excel VBA on Mac OS to save as PDF sometimes doesn't work. It will give "Error while printing" then "Run-time error '1004': Application-defined or object-defined error". My code, which worked yesterday: 'a) For Windows Dim wksSheet As Worksheet, PS As String PS = Application.PathSeparator If InStr(1, Application.OperatingSystem, "Windows") > 0 Then Set wksSheet = ActiveSheet wksSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _ ThisWorkbook.Path & PS & pdfName, Quality:

Excel VBA Change Color Of Cell Based On Value

吃可爱长大的小学妹 提交于 2021-02-05 11:46:48
问题 I need some help with a function that can change the color of the cell based on if the value of the cell is equal to the value of another, currently the cell holds an =COUNT(##:##) and I need to to Change the color from red to green if that value is equal to the value in another cell. With my limited knowledge of VBA and excel I came up with this Function ChangeColor(CellColor As Range) Application.Volatile True If CellColor = cell.Value Then ChangeColor = cell.Interior.ColorIndex = 14 End

Match partial data from multiple cells and return value

爷,独闯天下 提交于 2021-02-05 11:38:53
问题 I am trying to match partial data from multiple cells and want value in return. Tried index match and search function but no luck. If anyone can help. Example: Sheet1: Cell "A1": BGRAP1 - Gig0/2/17 BGRAP22 - Gig0/2/16 Cell "A2": BRAMT2 - Gig0/2/0 PTKLP8 - Gig0/2/16 PTKLP1 - Gig0/2/16 PTKLP8 - Gig0/2/17 Cell "B1": S2165 Cell "B2": S2218 Sheet 2: Cell "A1": BGRAP1 Cell "A2": PTKLP8 Cell "A3": BGRAP22 Cell "A4": BRAMT2 Cell "A5": PTKLP8 Cell "A6": PTKLP1 Cell "B1": Gig0/2/17 Cell "B2": Gig0/2/17

What are macid filetypes in excel vba

落花浮王杯 提交于 2021-02-05 11:36:44
问题 What are all the possible MacID("filetype") I need the one specifically for CSV but i couldn't find a list anywhere online surprisingly. 回答1: First run: mdls "FileName" Find the TypeCode in the Output: kMDItemFSTypeCode = "TEXT" You can use: Dir(Path,MacID("TEXT")) 回答2: Just a little aside for this thread. Yes there are few places to find details of the MacIDs, but beware. If a file is create on a PC it may not have its MacID set correctly, or at all for that matter. I am working with Excel

Is Google Sheets less or more accurate than Microsoft Excel?

眉间皱痕 提交于 2021-02-05 11:14:29
问题 I am aware of the general problem of numerical inaccuracies with floating point numbers, but I would expect Excel and Google Sheets to behave the same. Unfortunately, they don't - see the following example: A1: 15.525 our reference A2: =3*5.175 should equal 15.525 A3: =A2=A1 shows TRUE, as expected, in both A4: =A2-A1 but A2 is actually smaller in Google Sheets, by -1.78E-15 [Excel shows 0.00E+00] B1: =ROUND(A1,2) shows 15.53, correct, in both B2: =ROUND(A2,2) shows 15.53, correct, in both -